1

How can I get the start and end time of the DAG in overall, which includes all the tasks (which is the initial task start time and end time of the last task)?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

1 Answers1

0

You can use the Airflow API:

For DAGs: api/v1/dags/{dag_id}/dagRuns

For tasks: api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ozs
  • 3,051
  • 1
  • 10
  • 19
  • Thank you for the answer, but over here again the data needs to be collected and required data needs to be sorted. Which again requires more set of coding. – Austin Jackson Jun 18 '23 at 12:54
  • Well I was able to get **time=context.get("task_instance").duration** time for the overall tasks within one dag. – Austin Jackson Jun 18 '23 at 12:56