You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2022/06/17 16:31:41 UTC

[airflow] branch main updated: Do not calculate grid root instances (#24528)

This is an automated email from the ASF dual-hosted git repository.

bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 8b054efba7 Do not calculate grid root instances (#24528)
8b054efba7 is described below

commit 8b054efba736b985c8fdb7a278f01d5f4934f857
Author: Brent Bovenzi <br...@gmail.com>
AuthorDate: Fri Jun 17 12:31:28 2022 -0400

    Do not calculate grid root instances (#24528)
    
    * do not calculate grid root instances
    
    * fix tests
---
 airflow/www/views.py               |  9 +++++++++
 tests/www/views/test_views_grid.py | 19 +------------------
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/airflow/www/views.py b/airflow/www/views.py
index 48943303f6..c780b08fdd 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -387,6 +387,15 @@ def dag_to_grid(dag, dag_runs, session):
                 '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 {
diff --git a/tests/www/views/test_views_grid.py b/tests/www/views/test_views_grid.py
index 81aa0e757b..a64a0452bb 100644
--- a/tests/www/views/test_views_grid.py
+++ b/tests/www/views/test_views_grid.py
@@ -116,7 +116,6 @@ def test_no_runs(admin_client, dag_without_runs):
             'id': None,
             'instances': [],
             'label': None,
-            'tooltip': '',
         },
     }
 
@@ -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': '',
         },
     }