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


##########
airflow/www/views.py:
##########
@@ -597,15 +597,16 @@ def collect_edges(task_group):
     edges = set()
 
     def get_downstream(task):
-        tasks_to_trace = task.downstream_list
+        tasks_to_trace = {(task, frozenset(task.downstream_list))}
         while tasks_to_trace:
-            tasks_to_trace_next: Set[str] = set()
-            for child in tasks_to_trace:
-                edge = (task.task_id, child.task_id)
-                if edge in edges:
-                    continue
-                tasks_to_trace_next.update(child.downstream_list)
-                edges.add(edge)
+            tasks_to_trace_next: Set[tuple] = set()
+            for task, children in tasks_to_trace:

Review Comment:
   Does `children` change when we are iterating through? If not, we can simply 
do this
   
   ```python
   tasks_to_trace = [task]
   while tasks_to_trace:
       for task in tasks_to_trace:
           for child in task.downstream_list:
               edge = (task.task_id, child.task_id)
               if edge in edges:
                   continue
               edges.add(edge)
               tasks_to_trace_next.append(child)
       tasks_to_trace = tasks_to_trace_next
   ```



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