class ActionTree.Action(execute, label)

The main class of ActionTree. An action to be started after all its dependencies are finished.

  • execute (callable) – the function to execute the action
  • label – whatever you want to attach to the action. Can be retrieved by label and get_preview().

The status of the action.

Possible values: Pending, Successful, Failed, Canceled.

Pending = 0

The initial status.

Successful = 1

The status after a successful execution.

Canceled = 2

The status after a failed execution where a dependency raised an exception.

Failed = 3

The status after a failed execution whre this action raised an exception.


The label passed to the constructor.


Add a dependency to be executed before this action. Order of insertion of dependencies is not important.

Parameters:dependency (Action) –

Return the list of this action’s dependencies.


Return the labels of this action and its dependencies, in an order that could be the execution order.

execute(jobs=1, keep_going=False)

Recursively execute this action’s dependencies then this action.

If dependencies raise exceptions, these exceptions are encapsulated in a CompoundException and thrown.

  • jobs (int) – number of actions to execute in parallel
  • keep_going (bool) – if True, then execution does not stop on first failure, but executes as many dependencies as possible.

The local datetime at the begining of the execution of this action.


The local datetime at the end of the execution of this action.

exception ActionTree.CompoundException(exceptions)

Exception thrown by Action.execute() when a dependency raises an exception.


The list of the encapsulated exceptions.

exception ActionTree.DependencyCycleException

Exception thrown by Action.add_dependency() when adding the new dependency would create a cycle.