You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@airflow.apache.org by Pradhan V <pr...@gmail.com> on 2022/02/11 10:49:50 UTC

Get the current DAG run duration programmatically after all the tasks complete.

Hi,

I would like to understand whether it's possible to programmatically get
the total amount of time that the current DAG execution took.

Use case:
There are many DAGs that are associated with different clients and we want
to publish a custom metric with the client ID, DAG ID and the DAG execution
duration to better understand the DAG execution durations of different
clients.

Any other solution or the best practice to follow for this use case is
greatly appreciated.

PS: Airflow does provide dagrun.duration.success.<dag_id> and
dagrun.duration.failed.<dag_id> metrics but it is difficult for us to
associate a DAG ID with a client ID in a monitoring tool like Grafana.


Thanks,
Pradhan.