You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2022/10/18 13:10:37 UTC

[airflow] 21/41: demote Removed state in priority for displaying task summaries (#26789)

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

ephraimanierobi pushed a commit to branch v2-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit a1aef37cae453c5acf363b94e5b38cea4d098ba3
Author: Brent Bovenzi <br...@astronomer.io>
AuthorDate: Fri Sep 30 11:52:28 2022 -0400

    demote Removed state in priority for displaying task summaries (#26789)
    
    (cherry picked from commit 14b38d714c747604425568059c4fc8ac9bb2dc16)
---
 airflow/www/static/js/graph.js           | 8 +-------
 airflow/www/templates/airflow/graph.html | 1 +
 airflow/www/utils.py                     | 2 +-
 airflow/www/views.py                     | 3 +++
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/airflow/www/static/js/graph.js b/airflow/www/static/js/graph.js
index 4e32da005b..6e34cc2829 100644
--- a/airflow/www/static/js/graph.js
+++ b/airflow/www/static/js/graph.js
@@ -21,7 +21,7 @@
 
 /*
   global d3, document, nodes, taskInstances, tasks, edges, dagreD3, localStorage, $,
-  autoRefreshInterval, moment, convertSecsToHumanReadable
+  autoRefreshInterval, moment, convertSecsToHumanReadable, priority
 */
 
 import { getMetaValue, finalStatesMap } from './utils';
@@ -600,12 +600,6 @@ function getNodeState(nodeId, tis) {
     }
   });
 
-  // In this order, if any of these states appeared in childrenStates, return it as
-  // the group state.
-  const priority = ['failed', 'upstream_failed', 'up_for_retry', 'up_for_reschedule',
-    'queued', 'scheduled', 'running', 'shutdown', 'restarting', 'removed',
-    'no_status', 'success', 'skipped'];
-
   return priority.find((state) => childrenStates.has(state)) || 'no_status';
 }
 
diff --git a/airflow/www/templates/airflow/graph.html b/airflow/www/templates/airflow/graph.html
index 975eb98f84..c4e28c32fb 100644
--- a/airflow/www/templates/airflow/graph.html
+++ b/airflow/www/templates/airflow/graph.html
@@ -136,6 +136,7 @@
     const tasks = {{ tasks|tojson }};
     let taskInstances = {{ task_instances|tojson }};
     const autoRefreshInterval = {{ auto_refresh_interval }};
+    const priority = {{ state_priority|tojson }};
   </script>
   <script src="{{ url_for_asset('d3.min.js') }}"></script>
   <script src="{{ url_for_asset('dagre-d3.min.js') }}"></script>
diff --git a/airflow/www/utils.py b/airflow/www/utils.py
index 0aaaf2b26e..453c38ce49 100644
--- a/airflow/www/utils.py
+++ b/airflow/www/utils.py
@@ -93,10 +93,10 @@ priority = [
     TaskInstanceState.RUNNING,
     TaskInstanceState.SHUTDOWN,
     TaskInstanceState.RESTARTING,
-    TaskInstanceState.REMOVED,
     None,
     TaskInstanceState.SUCCESS,
     TaskInstanceState.SKIPPED,
+    TaskInstanceState.REMOVED,
 ]
 
 
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 3fe94e0fd9..a2b0d1e76d 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -2808,6 +2808,8 @@ class Airflow(AirflowBaseView):
         else:
             external_log_name = None
 
+        state_priority = ['no_status' if p is None else p for p in wwwutils.priority]
+
         return self.render_template(
             'airflow/graph.html',
             dag=dag,
@@ -2830,6 +2832,7 @@ class Airflow(AirflowBaseView):
             dag_run_state=dt_nr_dr_data['dr_state'],
             dag_model=dag_model,
             auto_refresh_interval=conf.getint('webserver', 'auto_refresh_interval'),
+            state_priority=state_priority,
         )
 
     @expose('/duration')