Sitemap
Towards Data Engineering

Dive into data engineering with top Medium articles on big data, cloud, automation, and DevOps. Follow us for curated insights and contribute your expertise. Join our thriving community of professionals and enthusiasts shaping the future of data-driven solutions.

Member-only story

Airflow DAG won’t trigger on Schedule

--

Image generated with ChatGPT

You’ve set the right cron schedule, but somehow Airflow doesn’t trigger your DAG and you don’t know why? Check your start date.

I once had a DAG set up to run on a weekly schedule (30 12 * * MON). But I made the mistake to set start_date to days_ago(1). Now this was troubling because Airflow allows DAGs to run at the end of the schedule interval, not beginning. So essentially, it will always set next run time to 7 days in the future and kept on skipping the expected date. Like a never ending search, when the expected day came, it won’t trigger yet it will schedule next run to the new week.

Initially I didn’t catch why but after a bit of digging around the internet, I finally understood the “end of schedule interval” concept.

So to make this work, start_date had to be set to 7 days back if I would be using a weekly schedule.

If you’re like me and you’re facing this problem now, let me simulate this problem here.

from airflow import DAG
from airflow.utils.dates import days_ago
from airflow.decorators import task
import logging

default_args = {
'owner':'Obinna',
'start_date':days_ago(1)
}

with DAG(
dag_id = 'generic_dag_a_upstream',
default_args = default_args,
schedule_interval = '10 20 * * SAT'
) as dag:
@task
def just_succeed()…

--

--

Towards Data Engineering
Towards Data Engineering

Published in Towards Data Engineering

Dive into data engineering with top Medium articles on big data, cloud, automation, and DevOps. Follow us for curated insights and contribute your expertise. Join our thriving community of professionals and enthusiasts shaping the future of data-driven solutions.

Obinna Onyema
Obinna Onyema

Written by Obinna Onyema

Enjoying building solutions with data and AI. Machine Learning Researcher https://www.linkedin.com/in/obinna-onyema/

No responses yet