pierrejeambrun commented on code in PR #26658:
URL: https://github.com/apache/airflow/pull/26658#discussion_r985101030
##########
airflow/utils/task_group.py:
##########
@@ -453,6 +454,22 @@ def topological_sort(self, _include_subdag_tasks: bool =
False):
return graph_sorted
+ def get_task_dict(self) -> dict[str, AbstractOperator]:
+ """Returns a flat dictionary of task_id: AbstractOperator"""
+ task_map = {}
+ groups_to_visit = [self]
+
+ while groups_to_visit:
+ visiting = groups_to_visit.pop(0)
+
+ for child in visiting.children.values():
+ if isinstance(child, AbstractOperator):
+ task_map[child.task_id] = child
+ elif isinstance(child, TaskGroup):
Review Comment:
`elif` just in case `DAGNode` get additionnal subclasses
--
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]