Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the order that tasks are displayed in Grid view #22731

Closed
bbovenzi opened this issue Apr 4, 2022 · 3 comments · Fixed by #22741
Closed

Fix the order that tasks are displayed in Grid view #22731

bbovenzi opened this issue Apr 4, 2022 · 3 comments · Fixed by #22741
Assignees

Comments

@bbovenzi
Copy link
Contributor

bbovenzi commented Apr 4, 2022

The order that tasks are displayed in Grid view do not correlate with the order that the tasks would be expected to execute in the DAG. See example_bash_operator below:

Screen Shot 2022-04-04 at 11 47 31 AM

Screen Shot 2022-04-04 at 11 47 36 AM

We should update the task_group_to_tree function in views.py to better approximate the order that tasks would be run.

@ashb
Copy link
Member

ashb commented Apr 4, 2022

We've got this function already, so it might be as simple as using that?

airflow/airflow/models/dag.py

Lines 1716 to 1726 in 3849b4e

def topological_sort(self, include_subdag_tasks: bool = False):
"""
Sorts tasks in topographical order, such that a task comes after any of its
upstream dependencies.
Heavily inspired by:
http://blog.jupo.org/2012/04/06/topological-sorting-acyclic-directed-graphs/
:param include_subdag_tasks: whether to include tasks in subdags, default to False
:return: list of tasks in topological order
"""

Narrator: it wasn't. It never is

@eladkal
Copy link
Contributor

eladkal commented Apr 5, 2022

i wonder if using topological_sort may also solve #13044 ?

@ashb
Copy link
Member

ashb commented Apr 5, 2022

@eladkal Nope, that's purely an artefact of the chart/graphing libary we are using on the front end as expanding the collapsed TG doesn't request any new data -- it's already there in the nodes JS var

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants