uranusjr commented on code in PR #26658:
URL: https://github.com/apache/airflow/pull/26658#discussion_r979326972
##########
airflow/utils/task_group.py:
##########
@@ -453,6 +454,21 @@ 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 = {}
+
+ def build_map(dag_node):
+ if not isinstance(dag_node, TaskGroup):
+ task_map[dag_node.task_id] = dag_node
+ return
+
+ for child in dag_node.children.values():
+ build_map(child)
Review Comment:
It’s probably a good idea to rewrite this as a loop instead of recursive
calls, we have had some issues with very deep graphs in the past.
--
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]