uranusjr commented on code in PR #76420:
URL: https://github.com/apache/airflow/pull/76420#discussion_r4466735521


##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -2378,12 +2378,10 @@ def _check_for_removed_or_restored_tasks(
                         producer_contexts=coordinates.producer_contexts(ti),
                     )
                 except NotFullyPopulated:
-                    # Not all upstreams finished, so we can't tell what should 
be here. Remove everything.
+                    # Not all upstreams finished, so the count isn't known 
yet. Keep the expanded
+                    # instances: _revise_map_indexes_if_mapped never brings 
back a removed index, but
+                    # trims or extends pending ones once the upstreams finish.
                     if ti.region_index >= 0:
-                        self.log.debug(
-                            "Removing the unmapped TI '%s' as the mapping 
can't be resolved yet", ti
-                        )
-                        ti.state = TaskInstanceState.REMOVED
                         continue

Review Comment:
   This also skips the _Restoring task_ block below for `region_index >= 0`, so 
a mapped task that was removed from the Dag and re-added in the latest version, 
with its producer cleared in the same request, still stays REMOVED forever. 
Same for an index that was REMOVED by an earlier shrink and is back in range 
after the producer re-runs.



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