WorkflowBuilder#

class pharmpy.workflows.WorkflowBuilder(workflow=None, tasks=None, name=None)[source]#

Bases: WorkflowBase

Builder class for Workflow

Methods Summary

add_task(task[, predecessors])

Add a task to the workflow

gather(sources[, destination])

Gather output from multiple tasks to one task

insert_workflow(other[, predecessors])

Insert other workflow

replace_task(task, new_task)

Replace a task with a new task

scatter(source, destinations)

Scatter output from one task to multiple previously added tasks

Methods Documentation

add_task(task, predecessors=None)[source]#

Add a task to the workflow

Predecessors will be connected if given.

Parameters:
  • task (Task) – Task to add

  • predecessors (list or Task) – One or multiple predecessor tasks to connect to the added task

gather(sources, destination=None)[source]#

Gather output from multiple tasks to one task

The destination Task could be left out to keep the gathered output unconnected

Parameters:
  • sources (Iterable[Task]) – Tasks to gather from

  • destination (Optional[Task]) – The destination task

insert_workflow(other, predecessors=None)[source]#

Insert other workflow

Parameters:
  • other (Workflow) – Workflow to insert

  • predecessors (list or Task) – One or multiple predecessor tasks to connect to the inputs of the inserted workflow. If None all output tasks will be found and used as predecessors.

replace_task(task, new_task)[source]#

Replace a task with a new task

Parameters:
  • task (Task) – Task to replace

  • new_task (Task) – New task

scatter(source, destinations)[source]#

Scatter output from one task to multiple previously added tasks

The predecessor should return one value per successor task

Parameters:
  • source (Task) – The predecessor task

  • destinations (Iterable[Task]) – Tasks to scatter to