【问题标题】:Getting Anonymous caller does not have storage.objects.create access error while running wordcount on dataflow在数据流上运行 wordcount 时,获取匿名调用者没有 storage.objects.create 访问错误
【发布时间】:2021-04-11 20:58:20
【问题描述】:

我正在使用 python 在 apache Beam 包中运行 wordcount 模块的数据流快速入门。我能够在我的机器上本地运行它。但是,当我尝试通过在 runner 字段中指定数据流运行器来在数据流服务上运行它时,它会抛出错误:


 raise exceptions.HttpError.FromResponse(http_response)
RuntimeError: apitools.base.py.exceptions.HttpUnauthorizedError: HttpError accessing <https://www.googleapis.com/resumable/upload/storage/v1/b/hogwarts/o?alt=json&name=results%2Fbeam-temp-outputs-acb95dc89b0511eb9507185e0fbdf17c%2Fc5994362-a8ca-45cc-a375-85fafb619329.outputs&uploadType=resumable>: response: <{'x-guploader-uploadid': 'ABg5-UzsW55q9DUiXsssbR3c0I_X85oFxjAo-FFn_ZeZ3HtZdlWPXjcd1-euaquMiOw4znDrIl8qYkBeIOBUhUlBibI', 'date': 'Sun, 11 Apr 2021 20:37:04 GMT', 'vary': 'Origin, X-Origin', 'www-authenticate': 'Bearer realm="https://accounts.google.com/"', 'cache-control': 'no-cache, no-store, max-age=0, must-revalidate', 'expires': 'Mon, 01 Jan 1990 00:00:00 GMT', 'pragma': 'no-cache', 'content-length': '600', 'server': 'UploadServer', 'content-type': 'text/html; charset=UTF-8', 'alt-svc': 'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'status': '401'}>, content <{
  "error": {
    "code": 401,
    "message": "Anonymous caller does not have storage.objects.create access to hogwarts/results/beam-temp-outputs-acb95dc89b0511eb9507185e0fbdf17c/c5994362-a8ca-45cc-a375-85fafb619329.outputs.",
    "errors": [
      {
        "message": "Anonymous caller does not have storage.objects.create access to hogwarts/results/beam-temp-outputs-acb95dc89b0511eb9507185e0fbdf17c/c5994362-a8ca-45cc-a375-85fafb619329.outputs.",
        "domain": "global",
        "reason": "required",
        "locationType": "header",
        "location": "Authorization"
      }
    ]
  }
}

当我尝试在 google cloud sdk 中运行此代码时出现此错误:-

python -m apache_beam.examples.wordcount \ --region $REGION \ --input gs://dataflow-samples/shakespeare/kinglear.txt \ --output gs://hogwarts/results/outputs \--runner DataflowRunner \ --project MyProject1 \ --temp_location gs://hogwarts/tmp/ 

请告诉我如何解决这个问题。我已经提供了所需的访问权限,并且还使用相应的密钥更新了我的 GOOGLE 应用程序凭据。

【问题讨论】:

  • 根据错误,您没有在桶gs://hogwarts/results/中创建对象的权限。如果您是存储桶的所有者,请仔细检查权限。如果没有,请请求存储桶所有者授予您storage.objects.create 权限。

标签: python google-cloud-platform apache-beam dataflow


【解决方案1】:

您需要将gs://hogwarts 上的storage.objects.create 授予计算服务帐户。您可以在 GCP 控制台的 IAM 部分找到它。

计算帐户如下所示:xxxxxxxx-compute@developer.gserviceaccount.com,其中xxxxxxx 是您的项目编号。

【讨论】:

    猜你喜欢
    • 2021-04-14
    • 2019-09-12
    • 2019-08-21
    • 1970-01-01
    • 2020-09-23
    • 2019-10-11
    • 2019-12-11
    • 1970-01-01
    • 2020-08-11
    相关资源
    最近更新 更多