Why the Airflow Execution time is not using the schedule_interval?

Viewed 37

I wanted to see the execution time 2022-03-01T20:00:01Z but I see 2022-03-01T00:00:01Z . I want the job to be kicked off at 8PM UTC.

.. Code snipet

 [![default_args = {
    "owner": "delta",
    "depends_on_past": False,
    "start_date": datetime(2022, 3, 1),
    "retry_delay": timedelta(minutes=5),
    "max_active_runs": 1,
    # "schedule_interval": '@daily',
    "schedule_interval": '0 20 * * *',
    "catchup": False,
}][1]][1]
1 Answers

Looks like you may have a timezone issue if it's starting at midnight instead of 8pm UTC. To set the timezone, add the following to your DAG code:

import pendulum
local_tz = pendulum.timezone("Etc/UTC")

Then in your default_args add:

"start_date": datetime(2022, 3, 1, tzinfo=localtz),

Check this link for more information on timezone-aware DAGs.

If this doesn't resolve the issue, it may be because you set the start_date to today's date, and so the job only got picked up for the first time this morning at 00:00:01. If this is the case, your issue should resolve itself tonight and tomorrow. Remember that the start_date can be any time in the past if you want the DAG to start immediately.

Related