uranusjr commented on code in PR #38883:
URL: https://github.com/apache/airflow/pull/38883#discussion_r1577427771
##########
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:
You don’t need to change the call site. But I think `skip_all_except` should
support passing in an iterator; you can do that by changing this line
https://github.com/apache/airflow/blob/e69853ac9e222259bb9963b3b8359c294d84e148/airflow/models/skipmixin.py#L184
to use `branch_task_id_set` instead. This should be trivial and has no
consequences.
--
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]