Search code examples
airflowgoogle-cloud-composer

Composer Scheduler is not triggering my DAGs within the planned time


I have the following configuration and the DAG isn't running in the expected time:

import pendulum


default_args = {
    "start_date": pendulum.today(),
     "retries": 0,
}

schedule_interval: str = "1 0 * * *"

It has been two days the Next Run: 2022-08-25, 00:01:00 shows the correct day but it is not triggered.

Version: 2.2.5+composer 

Solution

  • Do not use dynamic start_date. This is explained in depth in Airflow FAQ.

    Specifically for your case since you are after a daily run, If you want the first DAGRun to start on 2022-08-05 at 01:00 AM then you should set start_date as 1 day behind since Airflow trigger runs at the end of the interval:

    from datetime import datetime
    
    default_args = {
        "start_date": datetime(2022, 08, 04, 01),
         "retries": 0,
    }
    
    dag = DAG(
        ...,
        schedule_interval="1 0 * * *",
        default_args=default_args,
    
    )
    

    Note that you can also do:

    from datetime import datetime
    
    default_args = {
         "retries": 0,
    }
    
    dag = DAG(
        ...,
        schedule_interval="1 0 * * *",
        start_date=datetime(2022, 08, 04, 01),
    
    )