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.
iter_links
()[source]¶Iterates over dependency links between children of the flow.
(A, B, meta)
, whereA
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.
(A, meta)
, whereA
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.
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.
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.
taskflow.patterns.graph_flow.
Flow
(name, retry=None)[source]¶Bases: taskflow.flow.Flow
Graph flow pattern.
Contained flows/tasks will be executed according to their dependencies which will be resolved by using the flows/tasks provides and requires mappings or by following manually created dependency links.
From dependencies a directed graph is built. If it has edge A -> B
,
this means B
depends on A
(and that the execution of B
must
wait until A
has finished executing, on reverting this means that the
reverting of A
must wait until B
has finished reverting).
Note: cyclic dependencies are not allowed.
link
(u, v, decider=None, decider_depth=None)[source]¶Link existing node u as a runtime dependency of existing node v.
Note that if the addition of these edges creates a cyclic graph
then a DependencyFailure
will be
raised and the provided changes will be discarded. If the nodes
that are being requested to link do not exist in this graph than a
ValueError
will be raised.
Parameters: |
|
---|
add
(*nodes, **kwargs)[source]¶Adds a given task/tasks/flow/flows to this flow.
Note that if the addition of these nodes (and any edges) creates
a cyclic graph then
a DependencyFailure
will be
raised and the applied changes will be discarded.
Parameters: |
|
---|
taskflow.patterns.graph_flow.
TargetedFlow
(*args, **kwargs)[source]¶Bases: taskflow.patterns.graph_flow.Flow
Graph flow with a target.
Adds possibility to execute a flow up to certain graph node (task or subflow).
set_target
(target_node)[source]¶Set target for the flow.
Any node(s) (tasks or subflows) not needed for the target node will not be executed.
add
(*args, **kwargs)¶Adds a given task/tasks/flow/flows to this flow.
Note that if the addition of these nodes (and any edges) creates
a cyclic graph then
a DependencyFailure
will be
raised and the applied changes will be discarded.
Parameters: |
|
---|
link
(*args, **kwargs)¶Link existing node u as a runtime dependency of existing node v.
Note that if the addition of these edges creates a cyclic graph
then a DependencyFailure
will be
raised and the provided changes will be discarded. If the nodes
that are being requested to link do not exist in this graph than a
ValueError
will be raised.
Parameters: |
|
---|
taskflow.deciders.
Depth
[source]¶Bases: taskflow.utils.misc.StrEnum
Enumeration of decider(s) area of influence.
ALL
= 'ALL'¶Default decider depth that affects all successor atoms (including ones that are in successor nested flows).
FLOW
= 'FLOW'¶Decider depth that affects all successor tasks in the same flow (it will not affect tasks/retries that are in successor nested flows).
Warning
While using this kind we are allowed to execute successors of things that have been ignored (for example nested flows and the tasks they contain), this may result in symbol lookup errors during running, user beware.
NEIGHBORS
= 'NEIGHBORS'¶Decider depth that affects only next successor tasks (and does not traverse past one level of successor tasks).
Warning
While using this kind we are allowed to execute successors of things that have been ignored (for example nested flows and the tasks they contain), this may result in symbol lookup errors during running, user beware.
ATOM
= 'ATOM'¶Decider depth that affects only targeted atom (and does not traverse into any level of successor atoms).
Warning
While using this kind we are allowed to execute successors of things that have been ignored (for example nested flows and the tasks they contain), this may result in symbol lookup errors during running, user beware.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.