airflow.utils.state

Module Contents

Classes

JobState

All possible states that a Job can be in.

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.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 = 'removed'[source]
SCHEDULED = 'scheduled'[source]
QUEUED = 'queued'[source]
RUNNING = 'running'[source]
SUCCESS = 'success'[source]
RESTARTING = 'restarting'[source]
FAILED = 'failed'[source]
UP_FOR_RETRY = 'up_for_retry'[source]
UP_FOR_RESCHEDULE = 'up_for_reschedule'[source]
UPSTREAM_FAILED = 'upstream_failed'[source]
SKIPPED = 'skipped'[source]
DEFERRED = '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?