在运行时设置气流环境变量

编程入门 行业动态 更新时间:2024-10-11 19:21:25
本文介绍了在运行时设置气流环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我在执行 airflow 二进制文件后设置了与airflow配置设置相对应的env vars,同时将DAG定义加载到内存中,这会产生相同的效果在执行二进制文件之前在操作系统级别设置了这些相同的环境变量?

If I set env vars corresponding to airflow config settings after executing the airflow binary and at the same time DAG definitions are being loaded into memory, will this have the same effect as having set these same env vars at the OS level prior to having executed the binary?

推荐答案

我找不到任何有关此操作是否能按预期工作的文档,都认为如果我必须通读源代码以解决问题,那么首先这样做可能不是一个好主意。

I wasn't able to find any documentation on whether this would work as intended and figured that if I had to read through the source to figure this out then it's probably not a good idea to be doing it in the first place.

我创建了两个 airflow.cfg 文件,而不是在运行时设置环境变量: airflow.prod.cfg 和 airflow.dev.cfg 。然后,我创建了一个外壳脚本 start.sh ,其中 cp 是相应的 .cfg 文件保存到 airflow.cfg 。

Instead of setting environment variables at runtime I've created two airflow.cfg files: airflow.prod.cfg and airflow.dev.cfg. I then created a shell script start.sh that cps the appropriate .cfg file to airflow.cfg prior to executing the airflow binary.

我不喜欢使用shell脚本来启动程序,但是我宁愿选择设置env vars来选择任何怪异的动作在运行时。

I don't love having to use the shell script to boot things up but I'd prefer that to chancing any kind of spooky action as a result of setting env vars at runtime.

更多推荐

在运行时设置气流环境变量

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

发布评论

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

>www.elefans.com

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