cli的气流通过参数 [英] airflow pass parameter from cli

查看:64
本文介绍了cli的气流通过参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将参数传递给:

Is there a way to pass a parameter to:

airflow trigger_dag dag_name {param}

我有一个脚本来监视目录中的文件-何时文件进入目标目录,我想触发dag传递文件路径作为参数。

I have a script that monitors a directory for files - when a file gets moves into the target directory I want to trigger the dag passing as a parameter the file path.

推荐答案

您可以传递像这样:

airflow trigger_dag --conf {"file_variable": "/path/to/file"} dag_id

然后在dag中,可以使用以下模板来访问此变量:

Then in your dag, you can access this variable using templating as follows:

{{ dag_run.conf.file_variable }}

如果这不起作用,则共享简单的dag版本可能有助于获得更好的答案。

If this doesn't work, sharing a simple version of your dag might help in getting better answers.

这篇关于cli的气流通过参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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