From 9f14b1766b0b9d95f741929b09549fcadbe1887f Mon Sep 17 00:00:00 2001 From: Jacob Ward Date: Wed, 1 Apr 2020 11:50:21 +0100 Subject: [PATCH] Fix dag duration metric --- airflow_prometheus_exporter/prometheus_exporter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/airflow_prometheus_exporter/prometheus_exporter.py b/airflow_prometheus_exporter/prometheus_exporter.py index 232d458..3ef209e 100644 --- a/airflow_prometheus_exporter/prometheus_exporter.py +++ b/airflow_prometheus_exporter/prometheus_exporter.py @@ -99,6 +99,10 @@ def get_dag_duration_info(): ), ), ) + .filter( + TaskInstance.start_date.isnot(None), + TaskInstance.end_date.isnot(None), + ) .group_by( max_execution_dt_query.c.dag_id, max_execution_dt_query.c.max_execution_dt, @@ -120,10 +124,6 @@ def get_dag_duration_info(): == dag_start_dt_query.c.execution_date, ), ) - .filter( - TaskInstance.start_date.isnot(None), - TaskInstance.end_date.isnot(None), - ) .all() )