Fragment metadata

Metadata in snapshot files

Example snapshot file structure:

- my-module
  |- fr3.pyc
  |- fr4.pyc
  |- fragments.yml
- fr1.py
- fr2.lua
- fragments.yml

/fragments.yml content:

fragments:
    "fr1.py":
        kind: Fragment, 
        fragmentMeta: 
            runtime: CPython,
            runtimeVersion: "3.5"
    "fr2.py":
        kind: Fragment, 
        fragmentMeta: 
            runtime: LuaJit
    "my-module/fr3.pyc":
        kind: Fragment, 
        fragmentMeta: 
            runtime: CPython,
            format: CPythonByteCode

/my-module/fragments.yml content:

fragments:
    "my-module/fr4.pyc":
        kind: Fragment, 
        fragmentMeta: 
            runtime: CPython,
            runtimeVersion: "3.6"

Format

Example:

{
    "kind": "Fragment", 
    "fragmentMeta": {
        "runtime": "CPython",
        "runtimeVersion": "3.5",
        "format": "PythonSource",

        // optional flags, may be null
        "requireTvm": false,
        "requireSubFragments": false,
        "allowRestart": false
    }
}

runtime

Available fragment runtimes:

  • LuaJ
  • LuaC
  • LuaJit
  • CPython
  • DockerBuild - "virtual" runtime for running Dockerfile (build image)

runtimeVersion

Optional.

Possible values are specific for each type of runtime. If the value is not specified, the latest version of the specified runtime is used. Also, after enabling PTS this version can be calculated automatically, based on fragment content and metadata.

format

Possible formats:

  • CPythonByteCode
  • LuaByteCode
  • PythonSource
  • LuaSource
  • Dockerfile

requireTvm

Optional.

  • If true, the transaction will fail when the execution of this fragment is requested and the execution parameters forbid TVM usage.
  • If false, the transaction will fail when the fragment tries to do some TVM-related operation.
  • If not specified, PTS can calculate this value automatically.

requireSubFragments

Optional.

  • If true, the transaction will fail when the execution of this fragment is requested and the execution parameters forbid subfragments.
  • If false, the transaction will fail when the fragment tries to spawn another fragment.
  • If not specified, PTS can calculate this value automatically.

allowRestart

Optional.

  • If true, fragment can be restarted unlimited number of times (the exact number depends on situation).
  • If false, the transaction will fail when CPVM tries to restart this fragment (speculation fail or cluster node failure).
  • If not specified, PTS can calculate this value automatically.