kacpermuda commented on code in PR #75132:
URL: https://github.com/apache/airflow/pull/75132#discussion_r4323833676


##########
airflow-core/src/airflow/api_fastapi/execution_api/datamodels/taskinstance.py:
##########
@@ -457,6 +457,28 @@ class LoopContext(BaseModel):
     terminal_task_id: str
     terminal_is_mapped: bool
 
+    region_id: uuid.UUID
+    """
+    The loop region holding this iteration.
+
+    A mapped task's own ``region_id`` is its expansion's, so this is how its 
instances are tied to the
+    unmapped tasks of the same pass.
+    """
+
+    trajectory: int = Field(default=1, ge=1)
+    """
+    1 for the loop's original region, and one more for each fork of it.
+
+    Clearing a loop with its later iterations forks the loop region, and the 
iterations from
+    ``resumes_from_index`` on run again in the fork.
+    """
+
+    forked_from_region_id: uuid.UUID | None = None
+    """The loop region this fork replaces from ``resumes_from_index`` on, 
``None`` for an original region."""
+
+    resumes_from_index: int = Field(default=0, ge=0)
+    """The first iteration ``region_id`` holds, 0 for an original region."""

Review Comment:
   You’re right about the docstring: a fork can replace iterations held by 
several earlier regions, not only the one it was forked from. It now says it’s 
the previous region in the chain. I’d like to keep the field: it links a rerun 
to the one before it without relying on any ordering, and it should still hold 
per loop if nested loops ever come.



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