'Airflow scheduled dags now working as expected


I cannot understand how scheduler works, I created some dags with:

schedule_interval="0 21 * * *",
start_date=pendulum.datetime(2022, 5, 3, tz="UTC"),
catchup=False,
"max_active_runs": 1,


I activated the dag yesterday afternoon around 15.00 and I executed manually the dags to verify they works.
This morning I checked the dag execution and I saw the the dags have not been executed yesterday (2022-05-03 at 21.00) as expected (this is the next run date reported by airflow) why?
What am I wronging?
I am using airflow 2.2.4 Thanks



Solution 1:[1]

Manual runs start as soon as you trigger it. Scheduled runs are subject to Airflow scheduling mechanisem. I explained it in Problem with start date and scheduled date in Apache Airflow

In your case start date of 2022-05-03 with interval of 0 21 * * * means that the first run will start on 2022-05-04 21:00. The execution_date of this run will be 2022-05-03 21:00. So if you wanted the first run to start on 2022-05-03 21:00 you need to set:

start_date=pendulum.datetime(2022, 5, 2, tz="UTC"),
schedule_interval="0 21 * * *",

Alternatively, if you want to specify exact run times you will need to use Timetables then you can customize DAG Scheduling with Timetables.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elad Kalif