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:53 UTC
[airflow] 37/41: Fix task duration cumulative chart (#26717)
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 ecd943915fdd41febdfde760fb28f7c3e29f994d
Author: Daniel Standish <15...@users.noreply.github.com>
AuthorDate: Tue Sep 27 15:54:59 2022 -0700
Fix task duration cumulative chart (#26717)
Previously the chart could go down, which should not happen for a cumulative chart. We fix that here.
Also, we add task fail durations to the non-cumulative chart for consistency.
(cherry picked from commit afa8e10df16a3806077c471818053b38076e37fb)
---
airflow/www/views.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/airflow/www/views.py b/airflow/www/views.py
index ea05b1e0c7..ce322d7a62 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -2933,10 +2933,11 @@ class Airflow(AirflowBaseView):
if task_instance.duration:
date_time = wwwutils.epoch(task_instance.execution_date)
x_points[task_instance.task_id].append(date_time)
- y_points[task_instance.task_id].append(float(task_instance.duration))
fails_dict_key = (task_instance.dag_id, task_instance.task_id, task_instance.run_id)
fails_total = fails_totals[fails_dict_key]
- cumulative_y[task_instance.task_id].append(float(task_instance.duration + fails_total))
+ y_points[task_instance.task_id].append(float(task_instance.duration + fails_total))
+
+ cumulative_y = {k: list(itertools.accumulate(v)) for k, v in y_points.items()}
# determine the most relevant time unit for the set of task instance
# durations for the DAG