Skip to content

Commit

Permalink
Do not calculate grid root instances (#24528)
Browse files Browse the repository at this point in the history
* do not calculate grid root instances

* fix tests
  • Loading branch information
bbovenzi committed Jun 17, 2022
1 parent 31f113e commit 8b054ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
9 changes: 9 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,15 @@ def get_summary(dag_run, children):
'end_date': group_end_date,
}

# We don't need to calculate summaries for the root
if task_group.group_id is None:
return {
'id': task_group.group_id,
'label': task_group.label,
'children': children,
'instances': [],
}

group_summaries = [get_summary(dr, children) for dr in dag_runs]

return {
Expand Down
19 changes: 1 addition & 18 deletions tests/www/views/test_views_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def test_no_runs(admin_client, dag_without_runs):
'id': None,
'instances': [],
'label': None,
'tooltip': '',
},
}

Expand Down Expand Up @@ -249,24 +248,8 @@ def test_one_run(admin_client, dag_with_runs: List[DagRun], session):
},
],
'id': None,
'instances': [
{
'end_date': None,
'run_id': 'run_1',
'start_date': None,
'state': 'success',
'task_id': None,
},
{
'end_date': '2021-07-01T01:02:03+00:00',
'run_id': 'run_2',
'start_date': '2021-07-01T01:00:00+00:00',
'state': 'running',
'task_id': None,
},
],
'instances': [],
'label': None,
'tooltip': '',
},
}

Expand Down

0 comments on commit 8b054ef

Please sign in to comment.