气流执行日期错误值

问题描述

我必须运行spark作业,在该spark作业中,我们必须将date作为参数读取当前目录。我正在使用Airflow安排工作。以下是一些信息

开始日期

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

schedule_interval

schedule_interval='20 0 * * *'

通过工作的价值

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

我们必须在前一天的午夜进行这项工作,但是这种表达方式让我约会了前一天。我加了5:30,因为我们的气流使用了UTC时间。

有人可以参考一下这里发生的事情吗?

谢谢

解决方法

以下是执行日期的定义

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=The%20execution%20time%20in%20Airflow,on%202019%E2%80%9312%E2%80%9306

您不需要值中的宏.timedelta(days = 1))。strftime(“%Y /%m /%d”)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...