Understanding the State Transition in a Workflow¶
High Level Overview of How a Workflow Progresses to Success¶
This state diagram illustrates a high-level, simplistic view of the state transitions that a workflow with a single task and node would go through as the user observes success.
The following sections explain the various observable (and some hidden) states for workflow, node, and task state transitions.
Workflow States¶
A workflow always starts in the Ready state and ends either in Failed, Succeeded, or Aborted state.
Any system error within a state causes a retry on that state. These retries are capped by system retries which eventually lead to an Aborted state if the failure persists.
Every transition between states is recorded in FlyteAdmin using workflowexecutionevent.
The phases in the above state diagram are captured in the admin database as specified here workflowexecution.phase and are sent as a part of the Execution event.
The state machine specification for the illustration can be found here.
Node States¶
This state diagram illustrates the node transition through various states. This is the core finite state machine for a node. From the user’s perspective, a workflow simply consists of a sequence of tasks. But to Flyte, a workflow internally creates a meta entity known as node.
Once a Workflow enters the Running state, it triggers the phantom start node of the workflow. The start node is considered to be the entry node of any workflow.
The start node begins by executing all its child-nodes using a modified Depth First Search algorithm recursively.
Nodes can be of different types as listed below, but all the nodes traverse through the same transitions:
Start Node - Only exists during the execution and is not modeled in the core spec.
Dynamic Node - Just a task node that does not return output but constitutes a dynamic workflow. When the task runs, it remains in the
RUNNINGstate. Once the task completes and Flyte starts executing the dynamic workflow, the overarching node that contains both the original task and the dynamic workflow enters DYNAMIC_RUNNING state.End Node - Only exists during the execution and is not modeled in the core spec
Every transition between states is recorded in FlyteAdmin using nodeexecutionevent.
Every NodeExecutionEvent can have any nodeexecution.phase.
Note
TODO: Add explanation for each phase.
The state machine specification for the illustration can be found here.
Task States¶
The state diagram above illustrates the various states through which a task transitions. This is the core finite state machine for a task.
Every transition between states is recorded in FlyteAdmin using taskexecutionevent.
Every TaskExecutionEvent can have any taskexecution.phase.
Note
TODO: Add explanation for each phase.
The state machine specification for the illustration can be found here.