tell me the fastest way to check whether dag is running or not using python rest api?

you can use this end point:

GET /api/experimental/dags/<DAG_ID>/dag_runs

to get a list of all dag runs and their statuses for example look at my output:

http://localhost:8080/api/experimental/dags/my_dag_id/dag_runs
[
    {
        "dag_id": "my_dag_id",
        "dag_run_url": "/admin/airflow/graph?dag_id=my_dag_id&execution_date=2020-11-04+00%3A00%3A00%2B00%3A00",
        "execution_date": "2020-11-04T00:00:00+00:00",
        "id": 62,
        "run_id": "scheduled__2020-11-04T00:00:00+00:00",
        "start_date": "2020-11-05T14:05:36.902918+00:00",
        "state": "running"
    },
    {
        "dag_id": "my_dag_id",
        "dag_run_url": "/admin/airflow/graph?dag_id=my_dag_id&execution_date=2020-11-05+14%3A05%3A32.496146%2B00%3A00",
        "execution_date": "2020-11-05T14:05:32.496146+00:00",
        "id": 61,
        "run_id": "manual__2020-11-05T14:05:32.496146+00:00",
        "start_date": "2020-11-05T14:05:32.505224+00:00",
        "state": "running"
    }
]

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top