gpt4 book ai didi

google-cloud-platform - 在 Google Cloud Composer 中使用 json 文件导入变量

转载 作者:行者123 更新时间:2023-12-05 01:31:33 24 4
gpt4 key购买 nike

如何使用命令行将 json 文件导入 Google Cloud Composer?

我试过下面的命令

gcloud composer environments run comp-env --location=us-central1 variables -- --import composer_variables.json

我收到以下错误
[2019-01-17 13:34:54,003] {configuration.py:389} INFO - Reading the config from /etc/airflow/airflow.cfg
[2019-01-17 13:34:54,117] {app.py:44} WARNING - Using default Composer Environment Variables. Overrides have not been applied.
Missing variables file.

但是当我使用以下命令设置单个变量时,它工作正常。
gcloud composer environments run comp-env --location=us-central1 variables -- --set variable_name variable_value

由于我要导入的变量超过 75 个,因此我们需要使用 json 文件导入它。请帮我解决这个问题

最佳答案

跟随命令 gcloud composer environments run {environment-name} variables -- --i {path-to-json-file}执行 airflow variables远程在 Airflow 容器内。因此,需要在 Airflow worker/scheduler pod 中访问 json 文件。所以你需要复制你的 var.json首先到GCS,然后运行命令。例如:

  • gcloud composer environments storage data import --source=your-var.json --environment={environment-name} --location={location}
  • gcloud composer environments run {environment-name} --location={location} variables -- --i /home/airflow/gcs/data/your-var.json .
  • 关于google-cloud-platform - 在 Google Cloud Composer 中使用 json 文件导入变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54237270/

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