我如何检查何时为特定的dag计划了下一次Airflow DAG运行? [英] How do I check when my next Airflow DAG run has been scheduled for a specific dag?
本文介绍了我如何检查何时为特定的dag计划了下一次Airflow DAG运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经设置了气流,并计划将某些DAG安排为每天一次 0 0 * * *。
I have airflow set up and running with some DAGs scheduled for once a day "0 0 * * *".
我想检查下一次是什么时候
I want to check when is the next time a specific dag has been scheduled to run, but I can't see where I can do that within the admin.
推荐答案
如果如果要使用 Airflow
的 CLI
,则有 next_execution
选项
If you want you use the Airflow
's CLI
, there's next_execution
option
获取DAG的下一个执行日期时间。
Get the next execution datetime of a DAG.
airflow next_execution [-h] [-sd SUBDIR] dag_id
UPDATE-1
如果您需要以编程方式进行操作(在气流任务
内) ,您可以参考
If you need to do it programmatically (within an Airflow task
), you can refer to
-
next_e
rel = nofollow noreferrer>函数 cli.py
- (现在移至
dag_next_execution(..)
dag_command.py
nofollow noreferrer>master
)
next_execution(..)
function ofcli.py
- (now moved to
dag_next_execution(..)
function ofdag_command.py
inmaster
)
@cli_utils.action_logging
def next_execution(args):
"""
Returns the next execution datetime of a DAG at the command line.
>>> airflow next_execution tutorial
2018-08-31 10:38:00
"""
dag = get_dag(args)
if dag.is_paused:
print("[INFO] Please be reminded this DAG is PAUSED now.")
if dag.latest_execution_date:
next_execution_dttm = dag.following_schedule(dag.latest_execution_date)
if next_execution_dttm is None:
print("[WARN] No following schedule can be found. " +
"This DAG may have schedule interval '@once' or `None`.")
print(next_execution_dttm)
else:
print("[WARN] Only applicable when there is execution record found for the DAG.")
print(None)
这篇关于我如何检查何时为特定的dag计划了下一次Airflow DAG运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文