The cinder.taskflow.patterns.base Module

class Flow(name, parents=None, uuid=None)

Bases: object

The base abstract class of all flow implementations.

It provides a set of parents to flows that have a concept of parent flows as well as a state and state utility functions to the deriving classes. It also provides a name and an identifier (uuid or other) to the flow so that it can be uniquely identifed among many flows.

Flows are expected to provide (if desired) the following methods: - add - add_many - interrupt - reset - rollback - run - soft_reset

RESETTABLE_STATES = set(['FAILURE', 'PENDING', 'INTERRUPTED', 'SUCCESS'])
RUNNABLE_STATES = set(['PENDING'])
SOFT_RESETTABLE_STATES = set(['INTERRUPTED'])
UNINTERRUPTIBLE_STATES = set(['FAILURE', 'PENDING', 'SUCCESS'])
add(task)

Adds a given task to this flow.

Returns the uuid that is associated with the task for later operations before and after it is ran.

add_many(*args, **kwargs)

Adds many tasks to this flow.

Returns a list of uuids (one for each task added).

interrupt()

Attempts to interrupt the current flow and any tasks that are currently not running in the flow.

Returns how many tasks were interrupted (if any).

name

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

reset(*args, **kwargs)

Fully resets the internal state of this flow, allowing for the flow to be ran again.

Note: Listeners are also reset.

rollback(*args, **kwargs)

Performs rollback of this workflow and any attached parent workflows if present.

run(*args, **kwargs)

Executes the workflow.

soft_reset(*args, **kwargs)

Partially resets the internal state of this flow, allowing for the flow to be ran again from an interrupted state only.

state

Provides a read-only view of the flow state.

uuid

Uniquely identifies this flow

Previous topic

The cinder.taskflow.exceptions Module

Next topic

The cinder.taskflow.patterns.linear_flow Module

This Page