jedcunningham commented on code in PR #71696:
URL: https://github.com/apache/airflow/pull/71696#discussion_r3797967637


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -396,7 +420,14 @@ def clear_task_instances(
         # the task is terminated and becomes eligible for retry.
         else:
             dr = ti.dag_run
-            if run_on_latest_version:
+            # Nothing to re-run on but the latest, either because the task 
instance has no
+            # version or because its run has none and the run loop below moves 
it there. The
+            # two columns disagree more often than you would think: the 
scheduler backfills a
+            # version onto a migrated run's task instances but never onto the 
run itself.
+            use_latest_version = (
+                run_on_latest_version or ti.dag_version_id is None or 
dr.created_dag_version_id is None

Review Comment:
   Good catch, fixed. The ti condition is now identical to the run-level one, 
and a version-less ti inherits dr.created_dag_version_id rather than jumping to 
the latest. It also turned out to reach the UI: the clear dialogs asked the 
same question of the ti instead of its run, so they offered a locked "run with 
latest" that the clear wouldn't honor, so that's fixed too.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to