cli的气流通过参数

编程入门 行业动态 更新时间:2024-10-26 22:30:50
本文介绍了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的气流通过参数

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

发布评论

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

>www.elefans.com

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