Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check when my next Airflow DAG run has been scheduled for a specific dag?

I have airflow set up and running with some DAGs scheduled for once a day "0 0 * * *".

I want to check when is the next time a specific dag has been scheduled to run, but I can't see where I can do that within the admin.

like image 782
siowy Avatar asked Sep 07 '18 02:09

siowy


People also ask

How often does Airflow check for new DAGs?

Airflow scans the dags_folder for new DAGs every dag_dir_list_interval , which defaults to 5 minutes but can be modified. You might have to wait until this interval has passed before a new DAG appears in the UI.

What is schedule interval in Airflow?

As Airflow has its scheduler and it adopts the schedule interval syntax from cron, the smallest data and time interval in the Airflow scheduler world is minute. Inside of the scheduler, the only thing that is continuously running is the scheduler itself.

How do I change the DAG schedule in Airflow?

To schedule a dag, Airflow just looks for the last execution date and sum the schedule interval . If this time has expired it will run the dag. You cannot simple update the start date. A simple way to do this is edit your start date and schedule interval , rename your dag (e.g. xxxx_v2.py) and redeploy it.


1 Answers

If you want to see that programmatically (tested with Airflow v2.2.4):

info = dag.next_dagrun_info(None)
info.run_after  # datetime.datetime(2022, 3, 9, 22, 0, tzinfo=Timezone('UTC'))

you can also have:

info.logical_date  # datetime.datetime(2022, 3, 8, 22, 0, tzinfo=Timezone('UTC'))
info.data_interval  # DataInterval(start=datetime.datetime(2022, 3, 8, 22, ...

like image 135
ItayB Avatar answered Sep 19 '22 18:09

ItayB