# cwltool.workflow_job

## Classes

`WorkflowJobStep` | Generated for each step in Workflow.steps().
`ReceiveScatterOutput` | Produced by the scatter generators.
`WorkflowJob` | Generates steps from the Workflow.
`WorkflowJobLoopStep` | Generated for each step in Workflow.steps() containing a loop directive.

## Functions

`parallel_steps`(steps, rc, runtimeContext) |
`nested_crossproduct_scatter`(process, joborder, ...) |
`crossproduct_size`(joborder, scatter_keys) | Compute the size of a cross product.
`flat_crossproduct_scatter`(process, joborder, ...) |
`dotproduct_scatter`(process, joborder, scatter_keys, ...) |
`match_types`(sinktype, src, iid, inputobj, linkMerge, ...) |
`object_from_state`(state, params, frag_only, ...[, ...]) |

## Module Contents

class cwltool.workflow_job.WorkflowJobStep(step)

  Generated for each step in Workflow.steps().

  Parameters:

    step (cwltool.workflow.WorkflowStep)

  step
  tool
  id
  submitted = False
  iterable: cwltool.utils.JobsGeneratorType | None = None
  completed = False
  name
  job(joborder, output_callback, runtimeContext)
    Parameters:

      - joborder (cwltool.utils.CWLObjectType)

      - output_callback (cwltool.utils.OutputCallbackType)

      - runtimeContext (cwltool.context.RuntimeContext)

    Return type:

      cwltool.utils.JobsGeneratorType

class cwltool.workflow_job.ReceiveScatterOutput(output_callback, dest, total)

  Produced by the scatter generators.

  Parameters:

    - output_callback (cwltool.utils.ScatterOutputCallbackType)

    - dest (cwltool.utils.ScatterDestinationsType)

    - total (int)

  dest
  processStatus = 'success'
  total
  output_callback
  steps: list[cwltool.utils.JobsGeneratorType | None] = []
  property completed: int

    The number of completed internal jobs.

    Return type:

      int

  receive_scatter_output(index, jobout, processStatus)

    Record the results of a scatter operation.

    Parameters:

      - index (int)

      - jobout (cwltool.utils.CWLObjectType)

      - processStatus (str)

    Return type:

      None

  setTotal(total, steps)

    Set the total number of expected outputs along with the steps.

    This is necessary to finish the setup.

    Parameters:

      - total (int)

      - steps (list[cwltool.utils.JobsGeneratorType | None])

    Return type:

      None

cwltool.workflow_job.parallel_steps(steps, rc, runtimeContext)
  Parameters:

    - steps (list[cwltool.utils.JobsGeneratorType | None])

    - rc (ReceiveScatterOutput)

    - runtimeContext (cwltool.context.RuntimeContext)

  Return type:

    cwltool.utils.JobsGeneratorType

cwltool.workflow_job.nested_crossproduct_scatter(process, joborder, scatter_keys, output_callback, runtimeContext)
  Parameters:

    - process (WorkflowJobStep)

    - joborder (cwltool.utils.CWLObjectType)

    - scatter_keys (collections.abc.MutableSequence[str])

    - output_callback (cwltool.utils.ScatterOutputCallbackType)

    - runtimeContext (cwltool.context.RuntimeContext)

  Return type:

    cwltool.utils.JobsGeneratorType

cwltool.workflow_job.crossproduct_size(joborder, scatter_keys)

  Compute the size of a cross product.

  Parameters:

    - joborder (cwltool.utils.CWLObjectType)

    - scatter_keys (collections.abc.MutableSequence[str])

  Return type:

    int

cwltool.workflow_job.flat_crossproduct_scatter(process, joborder, scatter_keys, output_callback, runtimeContext)
  Parameters:

    - process (WorkflowJobStep)

    - joborder (cwltool.utils.CWLObjectType)

    - scatter_keys (collections.abc.MutableSequence[str])

    - output_callback (cwltool.utils.ScatterOutputCallbackType)

    - runtimeContext (cwltool.context.RuntimeContext)

  Return type:

    cwltool.utils.JobsGeneratorType

cwltool.workflow_job.dotproduct_scatter(process, joborder, scatter_keys, output_callback, runtimeContext)
  Parameters:

    - process (WorkflowJobStep)

    - joborder (cwltool.utils.CWLObjectType)

    - scatter_keys (collections.abc.MutableSequence[str])

    - output_callback (cwltool.utils.ScatterOutputCallbackType)

    - runtimeContext (cwltool.context.RuntimeContext)

  Return type:

    cwltool.utils.JobsGeneratorType

cwltool.workflow_job.match_types(sinktype, src, iid, inputobj, linkMerge, valueFrom)
  Parameters:

    - sinktype (cwltool.utils.SinkType | None)

    - src (cwltool.utils.WorkflowStateItem)

    - iid (str)

    - inputobj (cwltool.utils.CWLObjectType)

    - linkMerge (str | None)

    - valueFrom (str | None)

  Return type:

    bool

cwltool.workflow_job.object_from_state(state, params, frag_only, supportsMultipleInput, sourceField, incomplete=False)
  Parameters:

    - state (dict[str, cwltool.utils.WorkflowStateItem | None])

    - params (cwltool.utils.ParametersType)

    - frag_only (bool)

    - supportsMultipleInput (bool)

    - sourceField (str)

    - incomplete (bool)

  Return type:

    cwltool.utils.CWLObjectType | None

class cwltool.workflow_job.WorkflowJob(workflow, runtimeContext)

  Generates steps from the Workflow.

  Parameters:

    - workflow (cwltool.workflow.Workflow)

    - runtimeContext (cwltool.context.RuntimeContext)

  workflow
  tool
  steps
  state: dict[str, cwltool.utils.WorkflowStateItem | None]
  processStatus = ''
  did_callback = False
  made_progress: bool | None = None
  outdir
  name
  do_output_callback(final_output_callback)
    Parameters:

      final_output_callback (cwltool.utils.OutputCallbackType)

    Return type:

      None

  receive_output(step, outputparms, final_output_callback, jobout, processStatus)
    Parameters:

      - step (WorkflowJobStep)

      - outputparms (list[cwltool.utils.CWLObjectType])

      - final_output_callback (cwltool.utils.OutputCallbackType)

      - jobout (cwltool.utils.CWLObjectType)

      - processStatus (str)

    Return type:

      None

  try_make_job(step, final_output_callback, runtimeContext)
    Parameters:

      - step (WorkflowJobStep)

      - final_output_callback (cwltool.utils.OutputCallbackType)

      - runtimeContext (cwltool.context.RuntimeContext)

    Return type:

      cwltool.utils.JobsGeneratorType

  run(runtimeContext, tmpdir_lock=None)

    Log the start of each workflow.

    Parameters:

      - runtimeContext (cwltool.context.RuntimeContext)

      - tmpdir_lock (Union[threading.Lock, None])

    Return type:

      None

  job(joborder, output_callback, runtimeContext)
    Parameters:

      - joborder (cwltool.utils.CWLObjectType)

      - output_callback (cwltool.utils.OutputCallbackType)

      - runtimeContext (cwltool.context.RuntimeContext)

    Return type:

      cwltool.utils.JobsGeneratorType

class cwltool.workflow_job.WorkflowJobLoopStep(step, container_engine)

  Generated for each step in Workflow.steps() containing a loop directive.

  Parameters:

    - step (WorkflowJobStep)

    - container_engine (str)

  step: WorkflowJobStep
  container_engine: str
  joborder: cwltool.utils.CWLObjectType | None = None
  processStatus: str = 'success'
  iteration: int = 0
  output_buffer: collections.abc.MutableMapping[str, collections.abc.MutableSequence[cwltool.utils.CWLOutputType | None] | cwltool.utils.CWLOutputType | None]
  job(joborder, output_callback, runtimeContext)

    Generate a WorkflowJobStep job until the when condition evaluates to False.

    Parameters:

      - joborder (cwltool.utils.CWLObjectType)

      - output_callback (cwltool.utils.OutputCallbackType)

      - runtimeContext (cwltool.context.RuntimeContext)

    Return type:

      cwltool.utils.JobsGeneratorType

  loop_callback(runtimeContext, jobout, processStatus)

    Update the joborder object with output values from the last iteration.

    Parameters:

      - runtimeContext (cwltool.context.RuntimeContext)

      - jobout (cwltool.utils.CWLObjectType)

      - processStatus (str)

    Return type:

      None