气流-获取dag运行的开始时间 [英] Airflow - Get start time of dag run
问题描述
是否有可能获得Airflow的实际开始时间?开始时间是指dag的第一个任务开始运行的确切时间。
我知道我可以使用宏来获取执行日期。如果作业是使用trigger_dag运行的,这就是我所说的开始时间,但是如果该作业是按日程运行的,则 {{execution_date}}
返回昨天的日期。 / p>
我也试图将 datetime.now()。isoformat()
放在dag代码的主体中,然后将其传递给任务,但这似乎返回任务第一次被调用的时间,而不是dag本身启动的时间。
{{dag_run.start_date}}
提供dag的实际开始时间
Is it possible to get the actual start time of a dag in Airflow? By start time I mean the exact time the first task of a dag starts running.
I know I can use macros to get the execution date. If the job is ran using trigger_dag this is what I would call a start time but if the job is ran on a daily schedule then {{ execution_date }}
returns yesterdays date.
I have also tried to place datetime.now().isoformat()
in the body of the dag code and then pass it to a task but this seems to return the time the task is first called rather than when the dag itself started.
{{ dag_run.start_date }}
provides the actual start time of the dag
这篇关于气流-获取dag运行的开始时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!