- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在常规的 python 代码中我可以这样做:
import time
int(time.time())
这给了我作为纪元的时间。我希望能够使用 Airflow 宏执行此操作:execution_date
这是我尝试过的:
"{{ strptime(execution_date.strftime('%Y-%m-%d %H:%M:%S'), '%d.%m.%Y %H:%M:%S') }}"
但这给出了:
jinja2.exceptions.UndefinedError: 'strptime' is undefined
我正在运行 Airflow 1.9 和 Python 2.7
最佳答案
从 Airflow 1.10 开始,Airflow 使用 Pendulum 作为日期时间,它具有返回纪元的属性 timestamp()
、int_timestamp
和 float_timestamp
。
所以,你可以这样做:
{{ execution_date.int_timestamp }}
文档:https://pendulum.eustace.io/docs/#attributes-and-properties
其他选项是:
{{ execution_date.strftime('%s') }} # Also Python 2
{{ execution_date.timestamp() }} # Python >=3.3
关于python - 如何将 execution_date 作为纪元时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55720663/
我想在触发器 DAG 中设置 execution_date。我正在使用操作符 TriggerDagRunOperator,这个操作符有参数 execution_date,我想设置当前的 executi
在常规的 python 代码中我可以这样做: import time int(time.time()) 这给了我作为纪元的时间。我希望能够使用 Airflow 宏执行此操作:execution_dat
给定一个 DAG 有一个 start_date,它在特定日期运行,相应的 DAGRun 的 execution_date 是怎样的 定义了吗? 我已阅读 documentation但是一个例子让我感到
这是我的代码: EXEC_TIMESTAMP = "{{ execution_date.strftime('%Y-%m-%d %H:%M') }}" query = """ se
在 Airflow 中,我想每周一上午 8 点运行一次 dag(execution_date 当然应该是“当天星期一上午 8 点”)。为此工作流程设置的相关参数是: 开始日期:“2018-03-19”
最近我对 Airflow 进行了太多测试,以至于 execution_date 有一个问题运行时 airflow trigger_dag . 我了解到 execution_date不是我们第一次从h
来自 cron 的 Airflow 的新手,试图了解 execution_date 宏如何应用于调度系统以及何时手动触发。我已经阅读了常见问题解答,并根据我预期的时间表设置了执行时间,并填写了正确的
在这个答案的帮助下 https://stackoverflow.com/a/41730510/4200352我正在执行一个 python 文件。 我使用 PythonOperator 并尝试将执行日期
假设我有一个 easteregg.py 文件: from airflow import DAG from dateutil import parser from datetime import tim
我是一名优秀的程序员,十分优秀!