Skip to content

Setting step variables

Alan B. Christie edited this page Aug 14, 2025 · 7 revisions

Setting the variable map (a Python dictionary of Step variable names and values) is probably the most complex part of workflow execution. Steps (Jobs) are launched using the InstanceLauncher class object that is provided when the engine is initialised. The launch() method of this object takes a LaunchParameters object where variables can either be provided in the specification or separately using the launch parameters specification_variables member: -

# Provide variables in the launch parameters specification
launch_parameters.specificaion["variables"] = step_variables
# ...or specification_variables.
# These variables "replace" any specification variables.
launch_parameters. specification_variables = step_variables

With some examples, we'll now explore the process of collecting together a step's variables, which involves inspecting the RunningWorkflow record, the step's input, options and outputs, and the workflow's variable-mapping.

Imortantly: --

  • All top-level variables defined by the workflow are provided by the User when they run the workflow
  • The variables are available in the RunningWorkflow record's variables property (a map of names and values)
  • The engine can assume that the workflow has been validated and all the required variables have been provided

In the following superfluous properties are omitted from the workflow for brevity. The following are essentially excerpts from otherwise valid workflows.

Example 1

variable-mapping:
  inputs:
  - name: candidateMolecules
  outputs:
  - name: clusteredMolecules
    from:
      step: final-step
      output: outputFile

steps:
- name: step-1
  inputs:
  - input: inputFile
    from:
      workflow-input: candidateMolecules
  outputs:
  - output: outputFile
    as: first-step.out.smi
Inputs
inputFile is declared as being derived from a workflow input. The engine needs to provide an inputFile variable. Heree it's value is the value will be the value of

Clone this wiki locally