Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Document recommendations for retrying blob.upload_from_filename #352

Closed
Assignees
HemangChothani
Labels
api: storageIssues related to the googleapis/python-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
@tschaub

Description

@tschaub

I'm seeing frequent 503 and 504 responses using theblob.upload_from_filename() method. An example trace looks like this:

503 POST https://storage.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=multipart: {  "error": {    "code": 503,    "message": "Backend Error",    "errors": [      {        "message": "Backend Error",        "domain": "global",        "reason": "backendError"      }    ]  }}: (u'Request failed with status code', 503, u'Expected one of', 200)' - Calling rollback() ...Traceback (most recent call last):  File "/my/app/module.py", line 112, in upload    blob.upload_from_filename(file_path)  File "/usr/local/lib/python2.7/dist-packages/google/cloud/storage/blob.py", line 2471, in upload_from_filename    checksum=checksum,  File "/usr/local/lib/python2.7/dist-packages/google/cloud/storage/blob.py", line 2359, in upload_from_file    _raise_from_invalid_response(exc)  File "/usr/local/lib/python2.7/dist-packages/google/cloud/storage/blob.py", line 3886, in _raise_from_invalid_response    raise exceptions.from_http_status(response.status_code, message, response=response)ServiceUnavailable: 503 POST https://storage.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=multipart: {  "error": {    "code": 503,    "message": "Backend Error",    "errors": [      {        "message": "Backend Error",        "domain": "global",        "reason": "backendError"      }    ]  }}: (u'Request failed with status code', 503, u'Expected one of', 200)

It looks like this method callsblob.upload_from_file() withnum_retries=None, so there is no retry strategy applied. I also see that thenum_retries argument is documented as deprecated.

Does this library provide an alternative way to retryblob.upload_from_filename() orblob.upload_from_file()? I can wrap these calls in retry logic of my own, but I see that retries are enabled by default for other functions.

I'm usinggoogle-cloud-storage==1.34.0. I've already pulled ingoogle-resumable-media==1.20.0 so I should be getting the recent resumable media retry fixes that came with#342.

Thanks for any tips on retrying uploads.

Metadata

Metadata

Labels

api: storageIssues related to the googleapis/python-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp