App Specification#

Overview#

The bfabric-app-runner allows you to define and execute applications in various environments, by configuring the application steps in a YAML configuration files, the so-called app specification.

App Specification Structure#

The specification can be provided in a YAML file with the following structure:

versions:
  - version: "1.0.0"
    commands:
      dispatch: ...
      process: ...
      collect: ...  # Optional

Commands#

Each app defines these core commands:

  • dispatch: Prepares input data. Called with: $workunit_ref $work_dir

  • process: Executes main logic. Called with: $chunk_dir

  • collect: (Optional) Organizes results. Called with: $workunit_ref $chunk_dir

Commands are discriminated by their type field.

pydantic model bfabric_app_runner.specs.app.commands_spec.CommandsSpec#

Defines the commands that are required to execute an app.

Show JSON schema
{
   "title": "CommandsSpec",
   "description": "Defines the commands that are required to execute an app.",
   "type": "object",
   "properties": {
      "dispatch": {
         "discriminator": {
            "mapping": {
               "docker": "#/$defs/CommandDocker",
               "shell": "#/$defs/CommandShell"
            },
            "propertyName": "type"
         },
         "oneOf": [
            {
               "$ref": "#/$defs/CommandShell"
            },
            {
               "$ref": "#/$defs/CommandDocker"
            }
         ],
         "title": "Dispatch"
      },
      "process": {
         "discriminator": {
            "mapping": {
               "docker": "#/$defs/CommandDocker",
               "shell": "#/$defs/CommandShell"
            },
            "propertyName": "type"
         },
         "oneOf": [
            {
               "$ref": "#/$defs/CommandShell"
            },
            {
               "$ref": "#/$defs/CommandDocker"
            }
         ],
         "title": "Process"
      },
      "collect": {
         "anyOf": [
            {
               "discriminator": {
                  "mapping": {
                     "docker": "#/$defs/CommandDocker",
                     "shell": "#/$defs/CommandShell"
                  },
                  "propertyName": "type"
               },
               "oneOf": [
                  {
                     "$ref": "#/$defs/CommandShell"
                  },
                  {
                     "$ref": "#/$defs/CommandDocker"
                  }
               ]
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Collect"
      }
   },
   "$defs": {
      "CommandDocker": {
         "additionalProperties": false,
         "properties": {
            "type": {
               "const": "docker",
               "default": "docker",
               "title": "Type",
               "type": "string"
            },
            "image": {
               "title": "Image",
               "type": "string"
            },
            "command": {
               "title": "Command",
               "type": "string"
            },
            "entrypoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Entrypoint"
            },
            "engine": {
               "default": "docker",
               "enum": [
                  "docker",
                  "podman"
               ],
               "title": "Engine",
               "type": "string"
            },
            "env": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Env",
               "type": "object"
            },
            "mac_address": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Mac Address"
            },
            "mounts": {
               "$ref": "#/$defs/MountOptions",
               "default": {
                  "work_dir_target": null,
                  "read_only": [],
                  "writeable": [],
                  "share_bfabric_config": true
               }
            },
            "hostname": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Hostname"
            },
            "custom_args": {
               "default": [],
               "items": {
                  "type": "string"
               },
               "title": "Custom Args",
               "type": "array"
            }
         },
         "required": [
            "image",
            "command"
         ],
         "title": "CommandDocker",
         "type": "object"
      },
      "CommandShell": {
         "additionalProperties": false,
         "properties": {
            "type": {
               "const": "shell",
               "default": "shell",
               "title": "Type",
               "type": "string"
            },
            "command": {
               "title": "Command",
               "type": "string"
            }
         },
         "required": [
            "command"
         ],
         "title": "CommandShell",
         "type": "object"
      },
      "MountOptions": {
         "additionalProperties": false,
         "properties": {
            "work_dir_target": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Work Dir Target"
            },
            "read_only": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Read Only",
               "type": "array"
            },
            "writeable": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Writeable",
               "type": "array"
            },
            "share_bfabric_config": {
               "default": true,
               "title": "Share Bfabric Config",
               "type": "boolean"
            }
         },
         "title": "MountOptions",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "dispatch",
      "process"
   ]
}

Config:
  • extra: str = forbid

  • populate_by_name: bool = True

Fields:
field collect: Annotated[CommandShell | CommandDocker, Discriminator(discriminator=type, custom_error_type=None, custom_error_message=None, custom_error_context=None)] | None = None#

The app collect command, can be omitted if your process command already creates an outputs.yml file.

It will be called with arguments: $workunit_ref $chunk_dir.

field dispatch: Annotated[CommandShell | CommandDocker, Discriminator(discriminator=type, custom_error_type=None, custom_error_message=None, custom_error_context=None)] [Required]#

The app dispatch command.

It will be called with arguments: $workunit_ref $work_dir.

Constraints:
  • discriminator = type

field process: Annotated[CommandShell | CommandDocker, Discriminator(discriminator=type, custom_error_type=None, custom_error_message=None, custom_error_context=None)] [Required]#

The app process command.

It will be called with arguments: $chunk_dir.

Constraints:
  • discriminator = type

Shell Commands#

commands:
  dispatch:
    type: "shell"
    command: "python prepare_data.py"

The command string is split by spaces using shlex.split().

pydantic model bfabric_app_runner.specs.app.commands_spec.CommandShell#

Show JSON schema
{
   "title": "CommandShell",
   "type": "object",
   "properties": {
      "type": {
         "const": "shell",
         "default": "shell",
         "title": "Type",
         "type": "string"
      },
      "command": {
         "title": "Command",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "command"
   ]
}

Config:
  • extra: str = forbid

Fields:
field command: str [Required]#

The command to run, will be split by spaces and is not an actual shell script.

field type: Literal['shell'] = 'shell'#

Identifies the command type.

to_shell() list[str]#

Returns a shell command that can be used to run the specified command.

Docker Commands#

commands:
  process:
    type: "docker"
    image: "myapp:1.0.0"
    command: "/app/run.sh"
    env:
      APP_VERSION: "${app.version}"
    mounts:
      read_only:
        - ["/data/reference", "/app/reference"]
      writeable:
        - ["/data/results", "/app/results"]
pydantic model bfabric_app_runner.specs.app.commands_spec.CommandDocker#

Show JSON schema
{
   "title": "CommandDocker",
   "type": "object",
   "properties": {
      "type": {
         "const": "docker",
         "default": "docker",
         "title": "Type",
         "type": "string"
      },
      "image": {
         "title": "Image",
         "type": "string"
      },
      "command": {
         "title": "Command",
         "type": "string"
      },
      "entrypoint": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Entrypoint"
      },
      "engine": {
         "default": "docker",
         "enum": [
            "docker",
            "podman"
         ],
         "title": "Engine",
         "type": "string"
      },
      "env": {
         "additionalProperties": {
            "type": "string"
         },
         "default": {},
         "title": "Env",
         "type": "object"
      },
      "mac_address": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Mac Address"
      },
      "mounts": {
         "$ref": "#/$defs/MountOptions",
         "default": {
            "work_dir_target": null,
            "read_only": [],
            "writeable": [],
            "share_bfabric_config": true
         }
      },
      "hostname": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Hostname"
      },
      "custom_args": {
         "default": [],
         "items": {
            "type": "string"
         },
         "title": "Custom Args",
         "type": "array"
      }
   },
   "$defs": {
      "MountOptions": {
         "additionalProperties": false,
         "properties": {
            "work_dir_target": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Work Dir Target"
            },
            "read_only": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Read Only",
               "type": "array"
            },
            "writeable": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Writeable",
               "type": "array"
            },
            "share_bfabric_config": {
               "default": true,
               "title": "Share Bfabric Config",
               "type": "boolean"
            }
         },
         "title": "MountOptions",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "image",
      "command"
   ]
}

Config:
  • extra: str = forbid

Fields:
field command: str [Required]#

The command to execute in the container.

field custom_args: list[str] = []#

Any custom CLI arguments to pass to the container engine.

field engine: Literal['docker', 'podman'] = 'docker'#

The container engine to use.

field entrypoint: str | None = None#

The entrypoint to use for the container (instead of the image’s default).

field env: dict[str, str] = {}#

Environment variables to set in the container.

field hostname: str | None = None#

The hostname to use for the container (instead of Docker’s default assignment).

field image: str [Required]#

The container image to run.

field mac_address: str | None = None#

The MAC address to use for the container (instead of Docker’s default assignment).

field mounts: MountOptions = MountOptions(work_dir_target=None, read_only=[], writeable=[], share_bfabric_config=True)#

Mount options for the container.

field type: Literal['docker'] = 'docker'#

Identifies the command type.

to_shell(work_dir: Path | None = None) list[str]#

Returns a shell command that can be used to run the specified command.

pydantic model bfabric_app_runner.specs.app.commands_spec.MountOptions#

Show JSON schema
{
   "title": "MountOptions",
   "type": "object",
   "properties": {
      "work_dir_target": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Work Dir Target"
      },
      "read_only": {
         "default": [],
         "items": {
            "maxItems": 2,
            "minItems": 2,
            "prefixItems": [
               {
                  "format": "path",
                  "type": "string"
               },
               {
                  "format": "path",
                  "type": "string"
               }
            ],
            "type": "array"
         },
         "title": "Read Only",
         "type": "array"
      },
      "writeable": {
         "default": [],
         "items": {
            "maxItems": 2,
            "minItems": 2,
            "prefixItems": [
               {
                  "format": "path",
                  "type": "string"
               },
               {
                  "format": "path",
                  "type": "string"
               }
            ],
            "type": "array"
         },
         "title": "Writeable",
         "type": "array"
      },
      "share_bfabric_config": {
         "default": true,
         "title": "Share Bfabric Config",
         "type": "boolean"
      }
   },
   "additionalProperties": false
}

Config:
  • extra: str = forbid

Fields:
field read_only: list[tuple[Path, Path]] = []#
field share_bfabric_config: bool = True#
field work_dir_target: Path | None = None#
field writeable: list[tuple[Path, Path]] = []#
collect(work_dir: Path) list[tuple[Path, Path, bool]]#

Collects all mounts that are required to run the command.

These are returned as triplets of (source, target, read_only).

App Versions#

The AppVersionMultiTemplate class defines app versions in two ways:

  1. Single string: version: "1.0.0"

  2. List of strings: version: ["1.0.0", "1.0.1"]

Variables and Templating#

Available variables for Mako templates:

  • ${app.id}: Application ID (integer)

  • ${app.name}: Application name (alphanumeric, underscores, hyphens)

  • ${app.version}: Version string

Example:

image: "registry.example.com/${app.name}:${app.version}"
command: "/app/run.sh --app-id ${app.id}"

The interpolate_config_strings function processes all string values in the configuration after YAML loading.

Loading and Using App Specifications#

from pathlib import Path
from bfabric_app_runner.specs.app_spec import AppSpec

# Load from YAML
app_spec = AppSpec.load_yaml(Path("./app_spec.yaml"), app_id="123", app_name="MyApp")

# Check version
if "1.0.0" in app_spec:
    app_version = app_spec["1.0.0"]

Reference#

pydantic model bfabric_app_runner.specs.app.app_version.AppVersion#

Bases: BaseModel

A concrete app version specification.

For a better separation of concerns, the submitter will not be resolved automatically.

Show JSON schema
{
   "title": "AppVersion",
   "description": "A concrete app version specification.\n\nFor a better separation of concerns, the submitter will not be resolved automatically.",
   "type": "object",
   "properties": {
      "version": {
         "title": "Version",
         "type": "string"
      },
      "commands": {
         "$ref": "#/$defs/CommandsSpec"
      },
      "submitter": {
         "$ref": "#/$defs/SubmitterRef"
      },
      "reuse_default_resource": {
         "default": true,
         "title": "Reuse Default Resource",
         "type": "boolean"
      }
   },
   "$defs": {
      "CommandDocker": {
         "additionalProperties": false,
         "properties": {
            "type": {
               "const": "docker",
               "default": "docker",
               "title": "Type",
               "type": "string"
            },
            "image": {
               "title": "Image",
               "type": "string"
            },
            "command": {
               "title": "Command",
               "type": "string"
            },
            "entrypoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Entrypoint"
            },
            "engine": {
               "default": "docker",
               "enum": [
                  "docker",
                  "podman"
               ],
               "title": "Engine",
               "type": "string"
            },
            "env": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Env",
               "type": "object"
            },
            "mac_address": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Mac Address"
            },
            "mounts": {
               "$ref": "#/$defs/MountOptions",
               "default": {
                  "work_dir_target": null,
                  "read_only": [],
                  "writeable": [],
                  "share_bfabric_config": true
               }
            },
            "hostname": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Hostname"
            },
            "custom_args": {
               "default": [],
               "items": {
                  "type": "string"
               },
               "title": "Custom Args",
               "type": "array"
            }
         },
         "required": [
            "image",
            "command"
         ],
         "title": "CommandDocker",
         "type": "object"
      },
      "CommandShell": {
         "additionalProperties": false,
         "properties": {
            "type": {
               "const": "shell",
               "default": "shell",
               "title": "Type",
               "type": "string"
            },
            "command": {
               "title": "Command",
               "type": "string"
            }
         },
         "required": [
            "command"
         ],
         "title": "CommandShell",
         "type": "object"
      },
      "CommandsSpec": {
         "additionalProperties": false,
         "description": "Defines the commands that are required to execute an app.",
         "properties": {
            "dispatch": {
               "discriminator": {
                  "mapping": {
                     "docker": "#/$defs/CommandDocker",
                     "shell": "#/$defs/CommandShell"
                  },
                  "propertyName": "type"
               },
               "oneOf": [
                  {
                     "$ref": "#/$defs/CommandShell"
                  },
                  {
                     "$ref": "#/$defs/CommandDocker"
                  }
               ],
               "title": "Dispatch"
            },
            "process": {
               "discriminator": {
                  "mapping": {
                     "docker": "#/$defs/CommandDocker",
                     "shell": "#/$defs/CommandShell"
                  },
                  "propertyName": "type"
               },
               "oneOf": [
                  {
                     "$ref": "#/$defs/CommandShell"
                  },
                  {
                     "$ref": "#/$defs/CommandDocker"
                  }
               ],
               "title": "Process"
            },
            "collect": {
               "anyOf": [
                  {
                     "discriminator": {
                        "mapping": {
                           "docker": "#/$defs/CommandDocker",
                           "shell": "#/$defs/CommandShell"
                        },
                        "propertyName": "type"
                     },
                     "oneOf": [
                        {
                           "$ref": "#/$defs/CommandShell"
                        },
                        {
                           "$ref": "#/$defs/CommandDocker"
                        }
                     ]
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Collect"
            }
         },
         "required": [
            "dispatch",
            "process"
         ],
         "title": "CommandsSpec",
         "type": "object"
      },
      "MountOptions": {
         "additionalProperties": false,
         "properties": {
            "work_dir_target": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Work Dir Target"
            },
            "read_only": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Read Only",
               "type": "array"
            },
            "writeable": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Writeable",
               "type": "array"
            },
            "share_bfabric_config": {
               "default": true,
               "title": "Share Bfabric Config",
               "type": "boolean"
            }
         },
         "title": "MountOptions",
         "type": "object"
      },
      "SubmitterRef": {
         "description": "Reference of a submitter and potential configuration overrides.",
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "config": {
               "default": {},
               "title": "Config",
               "type": "object"
            }
         },
         "required": [
            "name"
         ],
         "title": "SubmitterRef",
         "type": "object"
      }
   },
   "required": [
      "version",
      "commands",
      "submitter"
   ]
}

Fields:
field commands: CommandsSpec [Required]#
field reuse_default_resource: bool = True#
field submitter: SubmitterRef [Required]#
field version: str [Required]#
pydantic model bfabric_app_runner.specs.app.app_version.AppVersionMultiTemplate#

Bases: BaseModel

Show JSON schema
{
   "title": "AppVersionMultiTemplate",
   "type": "object",
   "properties": {
      "version": {
         "items": {
            "type": "string"
         },
         "title": "Version",
         "type": "array"
      },
      "commands": {
         "$ref": "#/$defs/CommandsSpec"
      },
      "submitter": {
         "$ref": "#/$defs/SubmitterRef"
      },
      "reuse_default_resource": {
         "default": true,
         "title": "Reuse Default Resource",
         "type": "boolean"
      }
   },
   "$defs": {
      "CommandDocker": {
         "additionalProperties": false,
         "properties": {
            "type": {
               "const": "docker",
               "default": "docker",
               "title": "Type",
               "type": "string"
            },
            "image": {
               "title": "Image",
               "type": "string"
            },
            "command": {
               "title": "Command",
               "type": "string"
            },
            "entrypoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Entrypoint"
            },
            "engine": {
               "default": "docker",
               "enum": [
                  "docker",
                  "podman"
               ],
               "title": "Engine",
               "type": "string"
            },
            "env": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Env",
               "type": "object"
            },
            "mac_address": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Mac Address"
            },
            "mounts": {
               "$ref": "#/$defs/MountOptions",
               "default": {
                  "work_dir_target": null,
                  "read_only": [],
                  "writeable": [],
                  "share_bfabric_config": true
               }
            },
            "hostname": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Hostname"
            },
            "custom_args": {
               "default": [],
               "items": {
                  "type": "string"
               },
               "title": "Custom Args",
               "type": "array"
            }
         },
         "required": [
            "image",
            "command"
         ],
         "title": "CommandDocker",
         "type": "object"
      },
      "CommandShell": {
         "additionalProperties": false,
         "properties": {
            "type": {
               "const": "shell",
               "default": "shell",
               "title": "Type",
               "type": "string"
            },
            "command": {
               "title": "Command",
               "type": "string"
            }
         },
         "required": [
            "command"
         ],
         "title": "CommandShell",
         "type": "object"
      },
      "CommandsSpec": {
         "additionalProperties": false,
         "description": "Defines the commands that are required to execute an app.",
         "properties": {
            "dispatch": {
               "discriminator": {
                  "mapping": {
                     "docker": "#/$defs/CommandDocker",
                     "shell": "#/$defs/CommandShell"
                  },
                  "propertyName": "type"
               },
               "oneOf": [
                  {
                     "$ref": "#/$defs/CommandShell"
                  },
                  {
                     "$ref": "#/$defs/CommandDocker"
                  }
               ],
               "title": "Dispatch"
            },
            "process": {
               "discriminator": {
                  "mapping": {
                     "docker": "#/$defs/CommandDocker",
                     "shell": "#/$defs/CommandShell"
                  },
                  "propertyName": "type"
               },
               "oneOf": [
                  {
                     "$ref": "#/$defs/CommandShell"
                  },
                  {
                     "$ref": "#/$defs/CommandDocker"
                  }
               ],
               "title": "Process"
            },
            "collect": {
               "anyOf": [
                  {
                     "discriminator": {
                        "mapping": {
                           "docker": "#/$defs/CommandDocker",
                           "shell": "#/$defs/CommandShell"
                        },
                        "propertyName": "type"
                     },
                     "oneOf": [
                        {
                           "$ref": "#/$defs/CommandShell"
                        },
                        {
                           "$ref": "#/$defs/CommandDocker"
                        }
                     ]
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Collect"
            }
         },
         "required": [
            "dispatch",
            "process"
         ],
         "title": "CommandsSpec",
         "type": "object"
      },
      "MountOptions": {
         "additionalProperties": false,
         "properties": {
            "work_dir_target": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Work Dir Target"
            },
            "read_only": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Read Only",
               "type": "array"
            },
            "writeable": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Writeable",
               "type": "array"
            },
            "share_bfabric_config": {
               "default": true,
               "title": "Share Bfabric Config",
               "type": "boolean"
            }
         },
         "title": "MountOptions",
         "type": "object"
      },
      "SubmitterRef": {
         "description": "Reference of a submitter and potential configuration overrides.",
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "config": {
               "default": {},
               "title": "Config",
               "type": "object"
            }
         },
         "required": [
            "name"
         ],
         "title": "SubmitterRef",
         "type": "object"
      }
   },
   "required": [
      "version",
      "commands",
      "submitter"
   ]
}

Fields:
Validators:
field commands: CommandsSpec [Required]#
field reuse_default_resource: bool = True#
field submitter: SubmitterRef [Required]#
field version: list[str] [Required]#
Validated by:
  • _version_ensure_list

expand_versions() list[AppVersionTemplate]#

Returns a list of individual AppVersionTemplate instances, expanding each template of multiple versions. If substitutions are used they will not be expanded yet but rather when converting the template to a concrete AppVersion.

pydantic model bfabric_app_runner.specs.app.app_version.AppVersionTemplate#

Bases: BaseModel

Show JSON schema
{
   "title": "AppVersionTemplate",
   "type": "object",
   "properties": {
      "version": {
         "title": "Version",
         "type": "string"
      },
      "commands": {
         "$ref": "#/$defs/CommandsSpec"
      },
      "submitter": {
         "$ref": "#/$defs/SubmitterRef"
      },
      "reuse_default_resource": {
         "default": true,
         "title": "Reuse Default Resource",
         "type": "boolean"
      }
   },
   "$defs": {
      "CommandDocker": {
         "additionalProperties": false,
         "properties": {
            "type": {
               "const": "docker",
               "default": "docker",
               "title": "Type",
               "type": "string"
            },
            "image": {
               "title": "Image",
               "type": "string"
            },
            "command": {
               "title": "Command",
               "type": "string"
            },
            "entrypoint": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Entrypoint"
            },
            "engine": {
               "default": "docker",
               "enum": [
                  "docker",
                  "podman"
               ],
               "title": "Engine",
               "type": "string"
            },
            "env": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Env",
               "type": "object"
            },
            "mac_address": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Mac Address"
            },
            "mounts": {
               "$ref": "#/$defs/MountOptions",
               "default": {
                  "work_dir_target": null,
                  "read_only": [],
                  "writeable": [],
                  "share_bfabric_config": true
               }
            },
            "hostname": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Hostname"
            },
            "custom_args": {
               "default": [],
               "items": {
                  "type": "string"
               },
               "title": "Custom Args",
               "type": "array"
            }
         },
         "required": [
            "image",
            "command"
         ],
         "title": "CommandDocker",
         "type": "object"
      },
      "CommandShell": {
         "additionalProperties": false,
         "properties": {
            "type": {
               "const": "shell",
               "default": "shell",
               "title": "Type",
               "type": "string"
            },
            "command": {
               "title": "Command",
               "type": "string"
            }
         },
         "required": [
            "command"
         ],
         "title": "CommandShell",
         "type": "object"
      },
      "CommandsSpec": {
         "additionalProperties": false,
         "description": "Defines the commands that are required to execute an app.",
         "properties": {
            "dispatch": {
               "discriminator": {
                  "mapping": {
                     "docker": "#/$defs/CommandDocker",
                     "shell": "#/$defs/CommandShell"
                  },
                  "propertyName": "type"
               },
               "oneOf": [
                  {
                     "$ref": "#/$defs/CommandShell"
                  },
                  {
                     "$ref": "#/$defs/CommandDocker"
                  }
               ],
               "title": "Dispatch"
            },
            "process": {
               "discriminator": {
                  "mapping": {
                     "docker": "#/$defs/CommandDocker",
                     "shell": "#/$defs/CommandShell"
                  },
                  "propertyName": "type"
               },
               "oneOf": [
                  {
                     "$ref": "#/$defs/CommandShell"
                  },
                  {
                     "$ref": "#/$defs/CommandDocker"
                  }
               ],
               "title": "Process"
            },
            "collect": {
               "anyOf": [
                  {
                     "discriminator": {
                        "mapping": {
                           "docker": "#/$defs/CommandDocker",
                           "shell": "#/$defs/CommandShell"
                        },
                        "propertyName": "type"
                     },
                     "oneOf": [
                        {
                           "$ref": "#/$defs/CommandShell"
                        },
                        {
                           "$ref": "#/$defs/CommandDocker"
                        }
                     ]
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Collect"
            }
         },
         "required": [
            "dispatch",
            "process"
         ],
         "title": "CommandsSpec",
         "type": "object"
      },
      "MountOptions": {
         "additionalProperties": false,
         "properties": {
            "work_dir_target": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Work Dir Target"
            },
            "read_only": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Read Only",
               "type": "array"
            },
            "writeable": {
               "default": [],
               "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                     {
                        "format": "path",
                        "type": "string"
                     },
                     {
                        "format": "path",
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "title": "Writeable",
               "type": "array"
            },
            "share_bfabric_config": {
               "default": true,
               "title": "Share Bfabric Config",
               "type": "boolean"
            }
         },
         "title": "MountOptions",
         "type": "object"
      },
      "SubmitterRef": {
         "description": "Reference of a submitter and potential configuration overrides.",
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "config": {
               "default": {},
               "title": "Config",
               "type": "object"
            }
         },
         "required": [
            "name"
         ],
         "title": "SubmitterRef",
         "type": "object"
      }
   },
   "required": [
      "version",
      "commands",
      "submitter"
   ]
}

Fields:
field commands: CommandsSpec [Required]#
field reuse_default_resource: bool = True#
field submitter: SubmitterRef [Required]#
field version: str [Required]#
evaluate(app_id: str, app_name: str) AppVersion#

Evaluates the template to a concrete AppVersion instance.