gpt4 book ai didi

airflow - 如何指向 Airflow unittest.cfg?

转载 作者:行者123 更新时间:2023-12-04 04:17:36 28 4
gpt4 key购买 nike

Airflow 创建 unittest.cfg AIRFLOW_HOME 中的文件环境变量路径。

我的问题是:我如何指向 unittest.cfg与我指向 airflow.cfg 的原因相同通过环境变量 AIRFLOW_CONFIG ?

我之所以要这样做,是因为我不想在 AIRFLOW_HOME 中有任何配置文件。目录。

另外,如果有人知道得更好,请您解释一下什么是unittest.cfg是因为没有我能找到的文件。

最佳答案

unittest.cfg测试配置文件是 default configuration file当 Airflow 在测试模式下运行时使用。

可以通过设置 unit_test_mode configuration 来激活测试模式airflow.cfg 中的选项或 AIRFLOW__CORE__UNIT_TEST_MODE环境变量到 True .

测试配置文件中的配置值会覆盖 airflow.cfg 中的配置值在运行时激活测试模式。

# Source: https://github.com/apache/airflow/blob/1.10.5/airflow/configuration.py#L558,L561
def get_airflow_test_config(airflow_home):
if 'AIRFLOW_TEST_CONFIG' not in os.environ:
return os.path.join(airflow_home, 'unittests.cfg')
return expand_env_var(os.environ['AIRFLOW_TEST_CONFIG'])
AIRFLOW_TEST_CONFIG环境变量可以设置为测试配置文件的路径。

关于airflow - 如何指向 Airflow unittest.cfg?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55066692/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com