Skip to content
Open
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
6 changes: 3 additions & 3 deletions airflow-core/src/airflow/models/taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1806,9 +1806,9 @@ def fetch_handle_failure_context(
if task and fail_fast:
_stop_remaining_tasks(task_instance=ti, session=session)
else:
if ti.state == TaskInstanceState.RUNNING:
# If the task instance is in the running state, it means it raised an exception and
# about to retry so we record the task instance history. For other states, the task
if ti.state != TaskInstanceState.RESTARTING:
# If the task instance is NOT in the restarting state, it means it raised an exception and
# about to retry so we record the task instance history. For the restarting state, the task
# instance was cleared and already recorded in the task instance history.
ti.prepare_db_for_next_try(session)

Expand Down
2 changes: 1 addition & 1 deletion airflow-core/tests/unit/models/test_taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,7 @@ def test_handle_failure_updates_queued_task_updates_state(self, dag_maker):
dr = dag_maker.create_dagrun()
ti = dr.get_task_instance(task.task_id)
ti.state = State.QUEUED
session.merge(ti)
ti = session.merge(ti)
session.flush()
assert ti.state == State.QUEUED
ti.handle_failure("test queued ti", test_mode=True)
Expand Down
Loading