【问题标题】:Unable to upload a 1GB+ file from python storage google client无法从 python 存储谷歌客户端上传 1GB+ 文件
【发布时间】:2018-04-17 23:30:09
【问题描述】:

您好,我无法使用 google-cloud-storage~=1.6.0 客户端将 2GB 的“大”文件上传到 google 存储形式 kubernetes。

    client = storage.Client()
    self.bucket = client.get_bucket('test-bucket')
    blob = self.bucket.blob(remote_file)
    blob.upload_from_filename(local_file)

我给了 pod 很多内存 (4GB+) 认为它可能会解决它,但主人无论如何都会杀死它(OOMKilled),我想我在上传过程中缺少一些配置。

【问题讨论】:

  • 你检查你的防火墙了吗?!

标签: python kubernetes google-cloud-platform google-cloud-storage


【解决方案1】:

upload_from_filename 的默认行为是将整个文件读入内存,以便尝试一次全部上传。为了避免在调用blob.upload_from_filename 之前设置blob.chunk_size。合理的值可能是 1MiB (1024*1024)。

我怀疑这可能是一个新问题introduced by this commit

【讨论】:

  • 我遇到了同样的问题,blob.chunk_size = 1024 * 1024 在做blob.upload_from_filename(file) 之前对我来说非常适合。
猜你喜欢
  • 1970-01-01
  • 2017-12-07
  • 2016-03-21
  • 2014-09-25
  • 1970-01-01
  • 1970-01-01
  • 2021-01-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多