Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions airflow/utils/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ class TaskInstanceState(str, Enum):
SKIPPED = "skipped" # Skipped by branching or some other mechanism
DEFERRED = "deferred" # Deferrable operator waiting on a trigger

# Not used anymore, kept for compatibility.
# TODO: Remove in Airflow 3.0.
SHUTDOWN = "shutdown"
"""The task instance is being shut down.

:meta private:
"""

def __str__(self) -> str:
return self.value

Expand Down Expand Up @@ -100,6 +108,14 @@ class State:
SKIPPED = TaskInstanceState.SKIPPED
DEFERRED = TaskInstanceState.DEFERRED

# Not used anymore, kept for compatibility.
# TODO: Remove in Airflow 3.0.
SHUTDOWN = TaskInstanceState.SHUTDOWN
"""The task instance is being shut down.

:meta private:
"""

finished_dr_states: frozenset[DagRunState] = frozenset([DagRunState.SUCCESS, DagRunState.FAILED])
unfinished_dr_states: frozenset[DagRunState] = frozenset([DagRunState.QUEUED, DagRunState.RUNNING])

Expand Down Expand Up @@ -190,6 +206,15 @@ def color_fg(cls, state):
A list of states indicating that a task or dag is a success state.
"""

# Kept for compatibility. DO NOT USE.
# TODO: Remove in Airflow 3.0.
terminating_states = frozenset([TaskInstanceState.SHUTDOWN, TaskInstanceState.RESTARTING])
"""
A list of states indicating that a task has been terminated.

:meta private:
"""

adoptable_states = frozenset(
[TaskInstanceState.QUEUED, TaskInstanceState.RUNNING, TaskInstanceState.RESTARTING]
)
Expand Down
2 changes: 2 additions & 0 deletions tests/www/views/test_views_cluster_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def test_historical_metrics_data(admin_client, session, time_machine):
"restarting": 0,
"running": 0,
"scheduled": 0,
"shutdown": 0,
"skipped": 0,
"success": 2,
"up_for_reschedule": 0,
Expand Down Expand Up @@ -143,6 +144,7 @@ def test_historical_metrics_data_date_filters(admin_client, session):
"restarting": 0,
"running": 0,
"scheduled": 0,
"shutdown": 0,
"skipped": 0,
"success": 0,
"up_for_reschedule": 0,
Expand Down