Jump to: navigation, search

TaskFlow/Sates of Task and Flow

< TaskFlow
Revision as of 07:27, 10 September 2013 by Ivan Melnikov (talk | contribs) (task states description started)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Task States

Tf task state diagram.png

When task just added to the flow, it is in PENDING state, which means it can be executed or waits for all of task it depends on to complete. Then, when task is executed, it transitions to RUNNING state, and stays in it until its execute() method returns. When task is finished, it transitions to SUCCESS state if it was finished successfully, or to FAILURE state if not.

When flow is reverted, all tasks in PENDING state are left as is; tasks from all the other states transition to REVERTING state, and their revert() method is called. When that method returns, task transitions to REVERTED state, and then to PENDING.

Transition from RUNNING to REVERTING state happens when task was interrupted while running, and then revert occurs. This may take place e.g. when daemon is killed while running the task.

Transition from REVERTED to PENDING state happens immediately. The main purpose of REVERTED state is notifications.

Discuss: it may be worth to perform transition from REVERTED to PENDING automatically when resuming flow from storage.