gpt4 book ai didi

python - Google Cloud Storage 的 URLFetch 速率限制

转载 作者:太空宇宙 更新时间:2023-11-04 05:47:13 24 4
gpt4 key购买 nike

情况

我们使用 Cloud Storage 来存储大型 Elasticsearch 结果(来自聚合)。

为了并行处理这些大型聚合,我们将它们存储为多行 JSON 转储。

因此,为了执行并行处理,许多实例将同时打开此文件,因此,由于此记录的限制,达到了 URLFetch 速率限制 :

and the calls count against your URL fetch quota, as the library uses the URL Fetch service to interact with Cloud Storage.

这是产生的异常:

The pipeline UI gives this error

这是打开文件的代码:

import cloudstorage as gcs

def open_file(path, mode, **kwargs):
f = gcs.open(path, mode=mode, **kwargs)
if not f:
raise Exception("File could not be opened: %s" % path)

return f

问题

我们需要一种与 Cloud Storage 通信的方法来绕过 URLFetch 配额和速率限制,否则我们将无法有效地执行并行处理。

是否有一种不通过 URLFetch 路由的 App Engine 读取 GCS 文件的方法,就像数据存储 API 不会产生 url 提取速率限制一样?

最佳答案

不确定这种方法是否与您的应用程序兼容/可用,但是这里...

在并行聚合处理期间,您可以使用 GAE 数据存储来存储中间聚合结果(更宽松的配额),而不是将结果直接汇集到 GCS 文件,并且仅(在需要时组装并)在之后将最终结果发送到 GCS聚合在单个(或几个)GCS 请求中完成。

关于python - Google Cloud Storage 的 URLFetch 速率限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31707961/

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