如何为气流设置一个环境变量?

时间:2023-01-06 23:20:02

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.

当试图运行一个DAG时,Airflow返回一个错误,它说它找不到一个环境变量,这很奇怪,因为它能够找到另外3个我作为Python变量存储的环境变量。这些变量没有问题。

I have all 4 variables in ~/.profile and have also done

在~/中我有4个变量。简介和已经完成。

export var1="varirable1"
export var2="varirable2"
export var3="varirable3"
export var4="varirable4"

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

气流在什么用户下运行?我在sudo下也做过这些出口指令,所以我想当它运行dag时,它们会被气流接收。

1 个解决方案

#1


0  

Is it maybe because airflow uses non-login shell? Have you tried putting these lines in : ~/.bashrc instead of ~/.profile ?

可能是因为气流使用了非登录shell吗?你试过把这些线放进去吗?bashrc代替(~ /。配置文件?

#1


0  

Is it maybe because airflow uses non-login shell? Have you tried putting these lines in : ~/.bashrc instead of ~/.profile ?

可能是因为气流使用了非登录shell吗?你试过把这些线放进去吗?bashrc代替(~ /。配置文件?