DAG 不会根据调度间隔中指定的时间触发

DAG does not trigger based on the time specified in the schedule interval

假设开始日期是 2022 年 3 月 1 日。我希望 DAG 在世界标准时间每天早上 5 点 运行。这是我的 DAG:

args = {
    'owner': 'airflow',
    'start_date': datetime(2022, 3, 1),
    'depends_on_past': False, 
    'email': "xxx@xxx.com",
    'email_on_failure': False,
    'retry': 1,
    'retry_delay': timedelta(minutes=5),
    'schedule_interval': "0 5 * * *"
}

dag = DAG(
    dag_id='airflow_test',
    default_args=args,
    catchup=False
)

但是,此 dag 仍会 运行 在 2022-03-02 开始而不是 cron 表达式中指定的凌晨 5 点。有谁知道这里的潜在问题是什么?谢谢。

schedule_interval 移动到 DAG 定义可能会有所帮助。

根据 docs 这正是您指定的:

If you run a DAG on a schedule_interval of one day, the run with data interval starting on 2019-11-21 triggers after 2019-11-21T23:59.

Let’s Repeat That, the scheduler runs your job one schedule_interval AFTER the start date, at the END of the interval.

You should refer to DAG Runs for details on scheduling a DAG.

所以,为了 运行 在 2022 年 3 月 1 日,你可以 datetime(2022, 3, 1) - timedelta(days=1)

您必须在 dag 对象中定义计划间隔

and for your Dictionary you

with DAG(dag_id="dag_1", default_args=default_args, schedule_interval="*/10 * * * *") as dag:

试试这个让我知道