我如何检查何时为特定的dag计划了下一次Airflow DAG运行?

编程入门 行业动态 更新时间:2024-10-24 02:30:17
本文介绍了我如何检查何时为特定的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(..) master )
  • next_execution(..) function of cli.py
  • (now moved to dag_next_execution(..) function of dag_command.py in master)
@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运行?

本文发布于:2023-11-23 18:47:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622505.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:计划   dag   DAG   Airflow

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!