dheerajturaga opened a new pull request, #56321:
URL: https://github.com/apache/airflow/pull/56321
The SerializedTaskGroup.topological_sort() method had a critical bug in its
topological sorting algorithm. After checking if an upstream dependency's
parent
task group was still in the unsorted graph, the code failed to verify whether
such a parent was found before proceeding. This caused the else clause to
execute
even when nodes had unresolved parent task group dependencies, resulting in
tasks
being sorted out of dependency order in the grid view.
The fix adds the missing logic:
1. Check if a parent task group dependency exists (if tg:) and break if
found
2. Track progress with an acyclic flag to detect cycles or stuck states
3. Break the loop if no nodes are resolved in an iteration
Also added the missing hierarchical_alphabetical_sort() method to support
the
alternative grid_view_sorting_order configuration option.
This ensures tasks are displayed in the correct dependency order in the
grid view,
matching how they are executed.
Before:
<img width="1332" height="341" alt="tg_sort_graph"
src="https://github.com/user-attachments/assets/d2eba3fb-45dc-4e87-9913-d6e69939ac97"
/>
<img width="671" height="381" alt="tg_sort_grid_view_bad"
src="https://github.com/user-attachments/assets/dc0b6571-bd98-47d9-8ab4-794feb717f92"
/>
After:
<img width="622" height="362" alt="image"
src="https://github.com/user-attachments/assets/91c36d2b-4439-4200-ba5b-9da4e1346c3a"
/>
--
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]