u date错误值

bnl4lu3b  于 2021-05-27  发布在  Spark
关注(0)|答案(1)|浏览(552)

我必须运行spark作业,在这个spark作业中,我们必须传递date作为参数来读取当前目录。我用气流来安排工作。下面是一些信息
开始日期

import pendulum
local_tz = pendulum.timezone("Asia/Kolkata")
start_date': datetime(year=2020, month=8, day=3,tzinfo=local_tz)

计划\u间隔

schedule_interval='20 0 * * *'

传入作业的值

{{ (execution_date + macros.timedelta(hours=5,minutes=30) - macros.timedelta(days=1)).strftime("%Y/%m/%d") }}

我们必须在前一天午夜运行此作业,但此表达式表示我前天的日期。我加了5:30,因为我们的气流使用utc时间。
有人能解释一下这里发生了什么吗?
谢谢

khbbv19g

khbbv19g1#

以下是执行日期的定义

The execution time in Airflow is not the actual run time, but rather the start timestamp of its schedule period. For example, the execution time of the first DAG run is 2019–12–05 7:00:00, though it is executed on 2019–12–06.Dec 9, 2019

取自https://towardsdatascience.com/apache-airflow-tips-and-best-practices-ff64ce92ef8#:~:text=202019%e2%80%9312%e2%80%9306上的%20execution%20time%20in%20airflow。
值中不需要宏.timedelta(days=1)).strftime(“%y/%m/%d”)

相关问题