You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Aaryan123456679 (via GitHub)" <gi...@apache.org> on 2026/07/30 19:41:42 UTC
[PR] Fix dynamic task mapping timeout leaving unfinished tasks marked successful [airflow]
Aaryan123456679 opened a new pull request, #70795:
URL: https://github.com/apache/airflow/pull/70795
When a Dag run times out while a mapped task is still expanding, the scheduler marked its unfinished mapped task instances SKIPPED. Because SKIPPED does not count as a failure, the mapped task itself could still be reported as successful even though the Dag run that owned it timed out, misleading users about whether the run actually completed its work. Mark these task instances FAILED instead, so a timed-out Dag run is reflected consistently in the state of the tasks it left unfinished.
closes: #37332
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix dynamic task mapping timeout leaving unfinished tasks marked successful [airflow]
Posted by "Aaryan123456679 (via GitHub)" <gi...@apache.org>.
Aaryan123456679 commented on PR #70795:
URL: https://github.com/apache/airflow/pull/70795#issuecomment-5639407809
Hi Team, Friendly ping to get this PR reviewed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix dynamic task mapping timeout leaving unfinished tasks marked successful [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil closed pull request #70795: Fix dynamic task mapping timeout leaving unfinished tasks marked successful
URL: https://github.com/apache/airflow/pull/70795
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix dynamic task mapping timeout leaving unfinished tasks marked successful [airflow]
Posted by "subhramit (via GitHub)" <gi...@apache.org>.
subhramit commented on code in PR #70795:
URL: https://github.com/apache/airflow/pull/70795#discussion_r4085183218
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2948,7 +2948,7 @@ def _schedule_dag_run(
default=None,
)
for task_instance in unfinished_task_instances:
- task_instance.state = TaskInstanceState.SKIPPED
+ task_instance.state = TaskInstanceState.FAILED
Review Comment:
Correct me if I'm wrong, but won't this affect every DAG run timeout unconditionally and not only mapped tasks?
That would cause every unfinished TI of every timed-out run become FAILED, including TIs that never started.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix dynamic task mapping timeout leaving unfinished tasks marked successful [airflow]
Posted by "subhramit (via GitHub)" <gi...@apache.org>.
subhramit commented on code in PR #70795:
URL: https://github.com/apache/airflow/pull/70795#discussion_r4085292687
##########
airflow-core/tests/unit/jobs/test_scheduler_job.py:
##########
@@ -6620,7 +6620,7 @@ def test_do_schedule_max_active_runs_dag_timed_out(self, dag_maker, session):
run1 = session.merge(run1)
session.refresh(run1)
assert run1.state == State.FAILED
- assert run1_ti.state == State.SKIPPED
+ assert run1_ti.state == State.FAILED
Review Comment:
This test has no mapped task. Only a single `BashOperator`.
Could we add a regression test for the issue (a mapped task with some TIs running and some pending at timeout), and one for a teardown task?
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2948,7 +2948,7 @@ def _schedule_dag_run(
default=None,
)
for task_instance in unfinished_task_instances:
- task_instance.state = TaskInstanceState.SKIPPED
+ task_instance.state = TaskInstanceState.FAILED
Review Comment:
Correct me if I'm wrong, but won't this affect every DAG run timeout and not only mapped tasks?
That would cause every unfinished TI of every timed-out run become FAILED, including TIs that never started.
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2948,7 +2948,7 @@ def _schedule_dag_run(
default=None,
)
for task_instance in unfinished_task_instances:
- task_instance.state = TaskInstanceState.SKIPPED
+ task_instance.state = TaskInstanceState.FAILED
Review Comment:
This would also change teardown tasks as an unfinished teardown now would show FAILED, although it never ran.
"Mark run failed" does not change teardowns, sets running TIs to FAILED, and sets pending TIs to SKIPPED:
https://github.com/apache/airflow/blob/675d3e31675ee08e3f67fc99e2f679f7be2b2470/airflow-core/src/airflow/api/common/mark_tasks.py#L300-L318
Could we maybe use the same rule here? That would also fix the original issue, because the running mapped TIs become FAILED.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix dynamic task mapping timeout leaving unfinished tasks marked successful [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on PR #70795:
URL: https://github.com/apache/airflow/pull/70795#issuecomment-5942828092
Closing this. The description is about mapped tasks, but the change flips the one loop that handles every unfinished task instance of a timed-out Dag run, mapped or not and including ones that never started, from `SKIPPED` to `FAILED`. The only test change is in `test_do_schedule_max_active_runs_dag_timed_out`, which has no mapped task, and the review requesting changes hasn't been answered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org