如何设置环境变量以使用气流? [英] How do I set an environment variable for airflow to use?
问题描述
Airflow在尝试运行DAG时返回错误,提示它找不到环境变量,这很奇怪,因为它能够找到我存储为Python变量的其他3个环境变量。那些变量根本没有问题。
Airflow is returning an error when trying to run a DAG saying that it can't find an environment variable, which is odd because it's able to find 3 other environment variables that I'm storing as a Python variable. No issues with those variables at all.
我在〜/ .profile
中拥有所有4个变量,并且也完成了
I have all 4 variables in ~/.profile
and have also done
export var1="varirable1"
export var2="varirable2"
export var3="varirable3"
export var4="varirable4"
在用户做什么下气流
运行?我也已经完成了 sudo
下的 export
命令,因此我认为它们会被 airflow
运行dag
Under what user does airflow
run? I've done those export
commands under sudo
as well, so I thought they would be picked up by airflow
when it runs the dag
推荐答案
可能是因为airflow使用了非登录功能贝壳?您是否尝试过将这些行放在〜/ .bashrc而不是〜/ .profile中?
Is it maybe because airflow uses non-login shell? Have you tried putting these lines in : ~/.bashrc instead of ~/.profile ?
这篇关于如何设置环境变量以使用气流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!