子任务中的AirFlow dag id访问 [英] AirFlow dag id access in sub-tasks

查看:259
本文介绍了子任务中的AirFlow dag id访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含三个bash任务的DAG,该任务计划每天运行.

I have a DAG with three bash tasks which is scheduled to run every day.

我想在所有bash脚本中访问dag实例的唯一ID(可能是PID).

I would like to access unique ID of dag instance(may be PID) in all bash scripts.

有什么办法吗?

我正在寻找与Oozie类似的功能,可以在工作流xml或java代码中访问WORKFLOW_ID.

I am looking for similar functionality as Oozie where we can access WORKFLOW_ID in workflow xml or java code.

有人可以指出我有关如何在AirFlow DAG中使用内置变量和自定义变量"的文档吗?

Can somebody point me to documentation of AirFlow on "How to use in-build and custom variables in AirFlow DAG"

非常感谢 帕里

推荐答案

可以在jinja2中使用点符号访问对象的属性(请参见 https://airflow.apache.org/code.html#macros ).在这种情况下,它就是:

Object's attributes can be accessed with dot notation in jinja2 (see https://airflow.apache.org/code.html#macros). In this case, it would simply be:

{{ dag.dag_id }}

这篇关于子任务中的AirFlow dag id访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆