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


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -420,13 +420,9 @@ def clear_task_instances(
         # the task is terminated and becomes eligible for retry.
         else:
             dr = ti.dag_run
-            # 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
-            )
+            # A run with no version of its own has nothing to re-run on but 
the latest, and the
+            # run loop below moves it there.
+            use_latest_version = run_on_latest_version or 
dr.created_dag_version_id is None

Review Comment:
   This automatic switch still happens when `dag_run_state=False`, but the 
Dag-run loop
   that assigns `created_dag_version_id` is skipped entirely on line 459. 
Clearing a non-running TI on
   a versionless run therefore writes the latest version to the TI while 
leaving its run versionless;
   clearing a running versionless TI only changes it to `RESTARTING` and leaves 
it without a version
   at all.
   
   Version repair needs to run independently of whether the caller resets the 
Dag-run state. #71425
   provides that separation, but after rebasing its run-processing condition 
must also include runs
   whose `created_dag_version_id` is NULL even when the explicit latest-version 
flag is false. Please
   add regressions for a versionless run with `dag_run_state=False`, covering 
both a finished TI and a
   running TI.



-- 
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