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


##########
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 does not have to be public, I will prefix it with underscore.
   
   If I change this to a generator, how should I modify this part?
   
https://github.com/apache/airflow/blob/e69853ac9e222259bb9963b3b8359c294d84e148/airflow/operators/branch.py#L39
   
   Should I convert it into list from the generator something like this?
   ```python
   branch_task_ids = list(self._expand_task_group_roots(context["ti"], 
branches_to_execute))
   
   



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