简体   繁体   English

“execution_date”在 airflow dag 中超过前一天的日期(追赶模式为假)

[英]"execution_date" is passing previous day's date in airflow dag (catch up mode is false)

My airflow dag has catchup as false我的 airflow dag 追赶为假

Now when I am trying to pass execution_date airflow variable to a script then it it passing the date for previous day.现在,当我尝试将 execution_date airflow 变量传递给脚本时,它会传递前一天的日期。

My airflow timezone is set as America/Los_angelos in the airflow.cfg file (PST TIMEZONE)我的 airflow 时区在 airflow.cfg 文件(PST TIMEZONE)中设置为 America/Los_angelos

Also, it is defintely not a timezone issue.此外,这绝对不是时区问题。 I checked the timings in UTC.我检查了UTC的时间。 The PST dag time is on same UTC day PST dag 时间与 UTC 日期相同

If you want to pass the current date (ie the date the DAG is triggered) you need to pass data_interval_end .如果要传递当前日期(即触发 DAG 的日期),则需要传递data_interval_end This date represents the end of the data interval that the DAG covers and will be the date that the DAG is triggered.此日期表示 DAG 覆盖的数据间隔的结束,将是触发 DAG 的日期。

data_interval_end is a property on the dag_run object data_interval_enddag_run object上的属性

The reason why execution_date is one interval behind is explained here: https://airflow.apache.org/docs/apache-airflow/stable/faq.html#faq-what-does-execution-date-mean execution_date落后一个间隔的原因在这里解释: https://airflow.apache.org/docs/apache-airflow/stable/faq.html#faq-what-does-execution-date-mean

The data_interval is only available in Airflow 2.2+. data_interval仅在 Airflow 2.2+ 中可用。 If you are on a lower version, you will have to work it out yourself using the schedule and the execution date.如果您使用的是较低版本,则必须使用时间表和执行日期自己解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM