【问题标题】:Uploading a file to Google Bucket from local system using Airflow - Python使用 Airflow 将文件从本地系统上传到 Google Bucket - Python
【发布时间】:2018-09-08 01:15:18
【问题描述】:

所以我在气流上运行这个操作符

from airflow.contrib.operators.file_to_gcs import FileToGoogleCloudStorageOperator

gcp_operator = \
    FileToGoogleCloudStorageOperator(
        task_id='gcp_task',
        src='/Users/john/Documents/tmp',
        dst='gs://constantine-bucket',
        bucket='constantine-bucket',
        google_cloud_storage_conn_id='DataScience',
        mime_type='Folder',
        dag=dag
    )

当我运行它时,我得到一个错误

"error": "invalid_scope",
"error_description": "\u0026quot;https://www.googleapis.com/auth/devstorage.read_write\u0026quot; is not a valid audience string

有人知道如何在气流上运行此运算符吗?

【问题讨论】:

    标签: python google-cloud-platform google-cloud-datastore google-cloud-storage airflow


    【解决方案1】:

    听起来像是缺少依赖。您应该能够使用以下方法安装 GCP 挂钩和运算符:

    pip install apache-airflow[gcp_api]
    

    欲了解更多信息,请参阅此页面:https://airflow.apache.org/installation.html

    【讨论】:

    • 我可以在我的电脑上安装它。但是如何在 Airflow 上进行这些安装呢?
    • @JohnConstantine 我想这很大程度上取决于您在 PC 以外的任何地方运行 Airflow 的方式。也许你可以详细说明一下?很可能这本身就是一个问题。
    • @rob 所以我确实安装了库并得到另一个错误。我已经用它更新了问题
    • @JohnConstantine 可能是某个地方的拼写错误,请在此处阅读 FileToGCP 文档 (airflow.readthedocs.io/en/latest/code.html),并仔细检查您的所有配置变量和参数是否与您的 GCP 匹配
    猜你喜欢
    • 1970-01-01
    • 2011-08-05
    • 2020-06-13
    • 2012-05-30
    • 1970-01-01
    • 2014-01-04
    • 1970-01-01
    • 1970-01-01
    • 2019-05-15
    相关资源
    最近更新 更多