无法将大文件上传到Google云端存储 [英] Cannot upload large file to Google Cloud Storage

查看:156
本文介绍了无法将大文件上传到Google云端存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

处理小文件也可以.仅当我尝试上传大文件时,它才起作用.我正在使用Python客户端.该代码段是:

It is okay when dealing with small files. It doesn't work only when I try to upload large files. I'm using Python client. The snippet is:

filename='my_csv.csv'
storage_client = storage.Client()
bucket_name = os.environ["GOOGLE_STORAGE_BUCKET"]
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob("{}".format(filename))
blob.upload_from_filename(filename)  # file size is 500 MB

作为回溯,我唯一得到的是杀人",而且我没有使用python解释器.

The only thing I get as a Traceback is "Killed" and I'm out of python interpreter.

任何建议都应给予高度重视

Any suggestions are highly appriciated

修改: 它可以在本地计算机上正常工作.我的应用程序在Google Container Engine中运行,因此在celery任务中运行时会出现问题.

It works okay from local machine. My application runs in Google Container Engine, so problems occurs there when runs in celery task.

推荐答案

尝试分块上传文件.您可以在此处找到示例. (搜索request.next_chunk())

Try uploading the file in chunks. You can find samples here. (search for request.next_chunk())

这篇关于无法将大文件上传到Google云端存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆