Key Concepts

Task Manager

A task manager is a wrapper around one BlackDynamite study. A task is one pair of jobs and runs.

The Motoko task manager creates job/run pairs and can select subsets of runs using constraints. For example, it can select only finished runs:

finished = workflow.mult.select("state = FINISHED")

Workflow

The workflow is the top-level object. It owns all task managers and coordinates their creation and execution.

from motoko.workflow import Workflow


workflow = Workflow("motoko.yaml")
workflow.create()
workflow.start_launcher_daemons()
workflow.execute(inputs=[2.1, 3.1])

The workflow also stores persistent variables in workflow.vars and exposes task managers as attributes, such as workflow.mult or workflow.norm.

Orchestrator

An orchestrator is a Python module attached to a workflow. It registers asynchronous routines and event actions that decide when tasks should be created.

The workflow configuration points to an orchestrator function with module.function syntax:

orchestrator: orchestrator.main

Motoko loads orchestrator.py from the workflow directory and calls main(workflow, **params).