Patterns

class taskflow.flow.Flow(name, retry=None)[source]

Bases: object

The base abstract class of all flow implementations.

A flow is a structure that defines relationships between tasks. You can add tasks and other flows (as subflows) to the flow, and the flow provides a way to implicitly or explicitly define how they are interdependent. Exact structure of the relationships is defined by concrete implementation, while this class defines common interface and adds human-readable (not necessary unique) name.

NOTE(harlowja): if a flow is placed in another flow as a subflow, a desired way to compose flows together, then it is valid and permissible that during compilation the subflow & parent flow may be flattened into a new flow.

name

A non-unique name for this flow (human readable).

retry

The associated flow retry controller.

This retry controller object will affect & control how (and if) this flow and its contained components retry when execution is underway and a failure occurs.

add(*items)[source]

Adds a given item/items to this flow.

Iterates over dependency links between children of the flow.

Iterates over 3-tuples (A, B, meta), where
  • A is a child (atom or subflow) link starts from;
  • B is a child (atom or subflow) link points to; it is said that B depends on A or B requires A;
  • meta is link metadata, a dictionary.
iter_nodes()[source]

Iterate over nodes of the flow.

Iterates over 2-tuples (A, meta), where
  • A is a child (atom or subflow) of current flow;
  • meta is link metadata, a dictionary.
provides

Set of symbol names provided by the flow.

requires

Set of unsatisfied symbol names required by the flow.

Linear flow

class taskflow.patterns.linear_flow.Flow(name, retry=None)[source]

Bases: taskflow.flow.Flow

Linear flow pattern.

A linear (potentially nested) flow of tasks/flows that can be applied in order as one unit and rolled back as one unit using the reverse order that the tasks/flows have been applied in.

add(*items)[source]

Adds a given task/tasks/flow/flows to this flow.

Unordered flow

class taskflow.patterns.unordered_flow.Flow(name, retry=None)[source]

Bases: taskflow.flow.Flow

Unordered flow pattern.

A unordered (potentially nested) flow of tasks/flows that can be executed in any order as one unit and rolled back as one unit.

add(*items)[source]

Adds a given task/tasks/flow/flows to this flow.

Graph flow

Hierarchy