shahar1 commented on code in PR #60016:
URL: https://github.com/apache/airflow/pull/60016#discussion_r2657052145


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -2180,6 +2180,15 @@ def tg2(inp):
     # between the ancestor and further expansion happened inside it.
 
     ancestor_ti_count = get_mapped_ti_count(common_ancestor, run_id, 
session=session)
+    
+    # Special case: If both tasks are siblings in the same mapped task group
+    # (ti_count == ancestor_ti_count), they share the same map_index.
+    # This ensures depth-first execution where each mapped instance operates 
independently.
+    if ti_count == ancestor_ti_count:
+        # Both task and relative are in the same mapped group with no further 
expansion.
+        # They should share the same map_index.
+        return map_index
+    
     ancestor_map_index = map_index * ancestor_ti_count // ti_count
 
     # If the task is NOT further expanded inside the common ancestor, we

Review Comment:
   @uranusjr I'll be happy if you could provide some historical context - 
judging this comment, it seems that the proposed `if` used to exist in the 
past, but the only mention in the commit history I found was in the PR that 
introduced this comment https://github.com/apache/airflow/pull/27771.
   Was it omitted by mistake, or delebirately as part of the development?



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