pydra.engine.submitter module

Handle execution backends.

class pydra.engine.submitter.Submitter(plugin: str | Type[Worker] = 'cf', **kwargs)[source]

Bases: object

Send a task to the execution backend.


Close submitter.

Do not close previously running loop.

async expand_runnable(runnable, wait=False, rerun=False)[source]

This coroutine handles state expansion.

Removes any states from runnable. If wait is set to False (default), aggregates all worker execution coroutines and returns them. If wait is True, waits for all coroutines to complete / error and returns None.

  • runnable (pydra Task) – Task instance (Task, Workflow)

  • wait (bool (False)) – Await all futures before completing


futures – Coroutines for TaskBase execution.

Return type:

set or None

async expand_workflow(wf, rerun=False)[source]

Expand and execute a stateless Workflow. This method is only reached by Workflow._run_task.


wf (Workflow) – Workflow Task object


wf – The computed workflow

Return type:


async submit_from_call(runnable, rerun, environment)[source]

This coroutine should only be called once per Submitter call, and serves as the bridge between sync/async lands.

There are 4 potential paths based on the type of runnable: 0) Workflow has a different plugin than a submitter 1) Workflow without State 2) Task without State 3) (Workflow or Task) with State

Once Python 3.10 is the minimum, this should probably be refactored into using structural pattern matching.


Parse a graph and return all runnable tasks.

pydra.engine.submitter.is_runnable(graph, obj)[source]

Check if a task within a graph is runnable.

async pydra.engine.submitter.prepare_runnable_with_state(runnable)[source]