airflow.utils.state

Module Contents

Classes

JobState

All possible states that a Job can be in.

TerminalTIState

States that a Task Instance can be in that indicate it has reached a terminal state.

IntermediateTIState

States that a Task Instance can be in that indicate it is not yet in a terminal or running state.

TaskInstanceState

All possible states that a Task Instance can be in.

DagRunState

All possible states that a DagRun can be in.

State

Static class with task instance state constants and color methods to avoid hard-coding.

class airflow.utils.state.JobState[source]

Bases: str, enum.Enum

All possible states that a Job can be in.

RUNNING = 'running'[source]
SUCCESS = 'success'[source]
RESTARTING = 'restarting'[source]
FAILED = 'failed'[source]
__str__()[source]

Return str(self).

class airflow.utils.state.TerminalTIState[source]

Bases: str, enum.Enum

States that a Task Instance can be in that indicate it has reached a terminal state.

SUCCESS = 'success'[source]
FAILED = 'failed'[source]
SKIPPED = 'skipped'[source]
REMOVED = 'removed'[source]
__str__()[source]

Return str(self).

class airflow.utils.state.IntermediateTIState[source]

Bases: str, enum.Enum

States that a Task Instance can be in that indicate it is not yet in a terminal or running state.

SCHEDULED = 'scheduled'[source]
QUEUED = 'queued'[source]
RESTARTING = 'restarting'[source]
UP_FOR_RETRY = 'up_for_retry'[source]
UP_FOR_RESCHEDULE = 'up_for_reschedule'[source]
UPSTREAM_FAILED = 'upstream_failed'[source]
DEFERRED = 'deferred'[source]
__str__()[source]

Return str(self).

class airflow.utils.state.TaskInstanceState[source]

Bases: str, enum.Enum

All possible states that a Task Instance can be in.

Note that None is also allowed, so always use this in a type hint with Optional.

REMOVED[source]
SCHEDULED[source]
QUEUED[source]
RUNNING = 'running'[source]
SUCCESS[source]
RESTARTING[source]
FAILED[source]
UP_FOR_RETRY[source]
UP_FOR_RESCHEDULE[source]
UPSTREAM_FAILED[source]
SKIPPED[source]
DEFERRED[source]
__str__()[source]

Return str(self).

class airflow.utils.state.DagRunState[source]

Bases: str, enum.Enum

All possible states that a DagRun can be in.

These are “shared” with TaskInstanceState in some parts of the code, so please ensure that their values always match the ones with the same name in TaskInstanceState.

QUEUED = 'queued'[source]
RUNNING = 'running'[source]
SUCCESS = 'success'[source]
FAILED = 'failed'[source]
__str__()[source]

Return str(self).

class airflow.utils.state.State[source]

Static class with task instance state constants and color methods to avoid hard-coding.

SUCCESS[source]
RUNNING[source]
FAILED[source]
NONE[source]
REMOVED[source]
SCHEDULED[source]
QUEUED[source]
RESTARTING[source]
UP_FOR_RETRY[source]
UP_FOR_RESCHEDULE[source]
UPSTREAM_FAILED[source]
SKIPPED[source]
DEFERRED[source]
finished_dr_states: frozenset[DagRunState][source]
unfinished_dr_states: frozenset[DagRunState][source]
task_states: tuple[TaskInstanceState | None, Ellipsis] = (None,)[source]
dag_states: tuple[DagRunState, Ellipsis] = ()[source]
state_color: dict[TaskInstanceState | None, str][source]
finished: frozenset[TaskInstanceState][source]

A list of states indicating a task has reached a terminal state (i.e. it has “finished”) and needs no further action.

Note that the attempt could have resulted in failure or have been interrupted; or perhaps never run at all (skip, or upstream_failed) in any case, it is no longer running.

unfinished: frozenset[TaskInstanceState | None][source]

A list of states indicating that a task either has not completed a run or has not even started.

failed_states: frozenset[TaskInstanceState][source]

A list of states indicating that a task or dag is a failed state.

success_states: frozenset[TaskInstanceState][source]

A list of states indicating that a task or dag is a success state.

adoptable_states[source]

A list of states indicating that a task can be adopted or reset by a scheduler job if it was queued by another scheduler job that is not running anymore.

classmethod color(state)[source]

Return color for a state.

classmethod color_fg(state)[source]

Black&white colors for a state.

Was this entry helpful?