本文介绍了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的气流通过参数
发布评论