Skip to content

Commit

Permalink
demote Removed state in priority for displaying task summaries (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
bbovenzi authored Sep 30, 2022
1 parent 4b456d5 commit 14b38d7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
8 changes: 1 addition & 7 deletions airflow/www/static/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
}

Expand Down
1 change: 1 addition & 0 deletions airflow/www/templates/airflow/graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def get_instance_with_map(task_instance, session):
TaskInstanceState.RUNNING,
TaskInstanceState.SHUTDOWN,
TaskInstanceState.RESTARTING,
TaskInstanceState.REMOVED,
None,
TaskInstanceState.SUCCESS,
TaskInstanceState.SKIPPED,
TaskInstanceState.REMOVED,
]


Expand Down
3 changes: 3 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2810,6 +2810,8 @@ class GraphForm(DateTimeWithNumRunsWithDagRunsForm):
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,
Expand All @@ -2832,6 +2834,7 @@ class GraphForm(DateTimeWithNumRunsWithDagRunsForm):
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')
Expand Down

0 comments on commit 14b38d7

Please sign in to comment.