Workflow runner
The WorkflowRunner class is compatible with the Workbench Workflow Definition Language (WWDL) schema.
Instantiating a runner
Provided your run-time environment has the necessary environment variables to connect to an Azure Table Storage resource (for persisting log messages), you can create a workflow runner simply by:
from workbench.workflows import WorkflowRunner
from workbench.bindings import AzureBlobSession
session = AzureBlobSession(organization, workspace, session_id, user_id)
# The workflow can be defined in-line, provided it adheres to the schema
workflow = session.workflow
runner = WorkflowRunner(workflow=workflow)
For more details on setting up environment variables, see Local installation.
Workflow context
Some workflows require additional attributes to run. You can pass these attributes to a workflow runner as context when instantiating the workflow runner or by updating the runner's context dictionary.
context = {
organization: "example-org",
workspace:"My Test Workspace",
session_id: "clever-birds-learn".
user_id: "waad_..."
}
runner = WorkflowRunner(workflow=workflow, context=context)
Tip
Constructing your workflow to accept a DocumentVersion
or Session
object via the context is a clean way of scoping your workflow to operate on a particular file or dataset.
Running a workflow
To run a workflow call:
runner.run()