GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: replace default retry for upload operations by cojenco · Pull Request #480 · googleapis/python-storage

This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Conversation

@cojenco

@cojenco cojenco commented Jun 25, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR replaces upload operations default retries with storage.retry.DEFAULT_RETRY_IF_GENERATION_SPECIFIED and aligns with the retry strategy conditional idempotency.

With default retries set to storage.retry.DEFAULT_RETRY_IF_GENERATION_SPECIFIED, passing in ifGenerationMatch makes the upload operation (1) conditional and (2) only retried by default on whether the object's current generation matches the given value. Setting if_generation_match=0 makes the upload operation succeed only if there are no live versions of the object (fresh uploads) and supports retries.

  • revises upload operations both in entry methods and private methods
  • updates tests
  • revises docstrings
  • (update: separating this to feat: add preconditions and retry configuration to blob.create_resumable_upload_session #484 ) adds preconditions and retry configuration to an upload entry method blob.create_resumable_upload_session()

Fixes #477 🦕

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cojenco added 4 commits June 23, 2021 19:45
@cojenco
fix: revise upload operations preconditions to if_generation_match
139cd2c
@cojenco
fix docstrings
b57b863
@cojenco
add retry configuration to blob.create_resumable_upload_session
8c1ae3c
@cojenco
align var values in test
aec585b
@cojenco
cojenco requested review from a team June 25, 2021 16:44
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jun 25, 2021
@cojenco cojenco mentioned this pull request Jun 25, 2021
tests: add retry conformance test framework and test always idempotent operations #450
Merged
@cojenco
test coverage
e91916f
@cojenco
cojenco requested review from andrewsg, tritone and tseaver June 25, 2021 20:59
@product-auto-label product-auto-label Bot added the api: storage Issues related to the googleapis/python-storage API. label Jun 26, 2021
andrewsg
andrewsg approved these changes Jun 29, 2021
View reviewed changes

@andrewsg andrewsg left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work here. Please amend the PR title to include that create_resumable_upload_session is being amended in the same PR (or split it off into a separate PR) so that the change is included in the release notes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cojenco reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread google/cloud/storage/blob.py
This private method does not accept ConditionalRetryPolicy values
because the information necessary to evaluate the policy is instead
evaluated in client.download_blob_to_file().
evaluated in blob._do_upload().

@andrewsg andrewsg Jun 29, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it looks like we're evaluating it BOTH in blob._do_upload() and in client.download_blob_to_file(). This is harmless, which is why the tests didn't catch it, but we only need one of those.

I don't have a strong opinion on whether we do this in _do_upload or download_blob_to_file. Let's keep this docstring change and additionally we can remove the conditional retry policy code in client.download_blob_to_file, either in another PR, or in this one if you prefer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cojenco cojenco Jun 29, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, I believe we'll need to remain both ConditionalRetryPolicy evaluations as one is for upload operations and the other is for downloads. I revised the docstrings here to match particularly where we're doing the evaluations for upload operations, blob._do_upload() .

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tritone
tritone reviewed Jun 29, 2021
View reviewed changes

@tritone tritone left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch on this! A couple questions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/blob.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/blob.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_blob.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

cojenco added 5 commits June 29, 2021 12:50
@cojenco
Revert "test coverage"
6f7f3b6
This reverts commit e91916f.
@cojenco
Revert "align var values in test"
cccc4f4
This reverts commit aec585b.
@cojenco
Revert "add retry configuration to blob.create_resumable_upload_session"
18cdc86
This reverts commit 8c1ae3c.
@cojenco
revise tests after reverting
63ec083
@cojenco
Merge branch 'master' into update-upload-retry-477
6c96e01
@cojenco cojenco mentioned this pull request Jun 29, 2021
feat: add preconditions and retry configuration to blob.create_resumable_upload_session #484
Merged
tritone
tritone approved these changes Jun 30, 2021
View reviewed changes
@cojenco
Merge branch 'master' into update-upload-retry-477
75e78f3
@cojenco cojenco mentioned this pull request Jun 30, 2021
feat: public access prevention #304
Merged
4 tasks done
@cojenco
cojenco merged commit c027ccf into master Jun 30, 2021
@cojenco
cojenco deleted the update-upload-retry-477 branch June 30, 2021 16:23
cojenco added a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
@cojenco
fix: replace default retry for upload operations (googleapis#480)
d373d9f
* fix: revise upload operations preconditions to if_generation_match

* fix docstrings

* add retry configuration to blob.create_resumable_upload_session

* align var values in test

* test coverage

* Revert "test coverage"

This reverts commit e91916f.

* Revert "align var values in test"

This reverts commit aec585b.

* Revert "add retry configuration to blob.create_resumable_upload_session"

This reverts commit 8c1ae3c.

* revise tests after reverting
cojenco added a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
@cojenco
fix: replace default retry for upload operations (googleapis#480)
9330b3f
* fix: revise upload operations preconditions to if_generation_match

* fix docstrings

* add retry configuration to blob.create_resumable_upload_session

* align var values in test

* test coverage

* Revert "test coverage"

This reverts commit e91916f.

* Revert "align var values in test"

This reverts commit aec585b.

* Revert "add retry configuration to blob.create_resumable_upload_session"

This reverts commit 8c1ae3c.

* revise tests after reverting
@release-please release-please Bot mentioned this pull request Jan 12, 2022
chore(main): release 3.0.0 #688
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@tseaver tseaver Awaiting requested review from tseaver
2 more reviewers
@andrewsg andrewsg andrewsg approved these changes
@tritone tritone tritone approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: storage Issues related to the googleapis/python-storage API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uploads and if_metageneration_match and retries

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@cojenco @andrewsg @tritone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.