Skip to content

workflow

The workflow model: tasks, the references between them and their order.

SplitMode

Bases: StrEnum

How the pieces of a task are placed on the nodes.

Priority

Bases: StrEnum

The priority of a run in the queue.

WorkflowError

Bases: ValueError

A workflow which is not valid.

ResourceOverride

Bases: BaseModel

Resources of a task which replace the learned or default ones.

TaskSpec

Bases: BaseModel

A task of a workflow.

Attributes:

Name Type Description
id str

Identifier of the task within the workflow.

type str

Name of the task plugin.

settings dict[str, Any]

Settings handed to the plugin.

inputs dict[str, str]

Input port to the output of another task, <task>.<port>.

split SplitMode | None

Split mode of the task, the one of the workflow by default.

resources ResourceOverride | None

Resources replacing the learned or default ones.

stage list[str]

Input ports copied to local scratch.

dependencies

dependencies()

Ids of the tasks this task reads from, in input order, without repeats.

Workflow

Workflow(**data)

Bases: BaseModel

A workflow: tasks which read the outputs of each other.

Create a workflow, a reference error is raised as a WorkflowError.

task

task(task_id)

Return the task with the given id.

Raises:

Type Description
WorkflowError

If there is no such task.

order

order()

Return the tasks in topological order, stable in file order.

Raises:

Type Description
WorkflowError

If the references form a cycle.

load_workflow

load_workflow(path)

Read a workflow from a YAML file.

Raises:

Type Description
WorkflowError

If the file is not a valid workflow.

dump_workflow

dump_workflow(workflow, path)

Write a workflow as a YAML file.

workflow_yaml

workflow_yaml(workflow)

The compact YAML of a workflow: the fields which differ from the defaults.

name and tasks are always written, also when they are the defaults. A sequence is indented below its key, as the workflows of the docs are written.

Parameters:

Name Type Description Default
workflow Workflow

The workflow.

required

Returns:

Type Description
str

The YAML text.