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


##########
airflow/operators/branch.py:
##########
@@ -34,8 +36,42 @@ class BranchMixIn(SkipMixin):
     def do_branch(self, context: Context, branches_to_execute: str | 
Iterable[str]) -> str | Iterable[str]:
         """Implement the handling of branching including logging."""
         self.log.info("Branch into %s", branches_to_execute)
-        self.skip_all_except(context["ti"], branches_to_execute)
-        return branches_to_execute
+        branch_task_ids = self.expand_task_group_roots(context["ti"], 
branches_to_execute)
+        self.skip_all_except(context["ti"], branch_task_ids)
+        return branch_task_ids
+
+    def expand_task_group_roots(
+        self, ti: TaskInstance | TaskInstancePydantic, branches_to_execute: 
str | Iterable[str]
+    ) -> str | Iterable[str]:

Review Comment:
   It accepts any iterator but does not handle it correctly. `branch_task_ids` 
is iterated twice in the function, which you can’t do with an iterator. The 
line above is the second iteration we need to get rid of.



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