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 — feat(experimental): add bidi stream retry manager. by Pulkit0110 · Pull Request #1632 · googleapis/python-storage

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

Conversation

@Pulkit0110

@Pulkit0110 Pulkit0110 commented Nov 25, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor
  • Add bidi stream retry manager. It will the main class that would be responsible for retries.
  • Integrate MRD with bidi stream retry manager and reads resumption strategy
  • Added conformance tests for all error scenarios and smart resumption for bidi reads
  • Refactored MRD's download_ranges() method, which will now use retry manager's execute() method to send the requests
  • Modified the logic to parse and handle the BidiReadObjectRedirectedError.
  • Modified cloud build configuration to also pull the latest changes of the current PR.
  • Formatted few more files using black formatter

Sorry, something went wrong.

Uh oh!

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

All reactions
@Pulkit0110
Pulkit0110 requested review from a team November 25, 2025 09:26
@blunderbuss-gcf blunderbuss-gcf Bot assigned chandra-siri Nov 25, 2025
@product-auto-label product-auto-label Bot added size: l Pull request size is large. api: storage Issues related to the googleapis/python-storage API. labels Nov 25, 2025
@gemini-code-assist

gemini-code-assist Bot commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Pulkit0110, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a foundational component for enhancing the reliability of asynchronous bidirectional streaming operations within the google-cloud-storage library. By providing a dedicated retry manager, it enables robust handling of transient failures, ensuring that streaming operations can automatically recover and continue without manual intervention. This change is crucial for improving the overall stability and user experience of experimental asynchronous features.

Highlights

  • New Bidirectional Stream Retry Manager: Introduced _BidiStreamRetryManager, a new class responsible for managing retry logic for asynchronous bidirectional streaming operations. This manager integrates with a _BaseResumptionStrategy to handle state management during retries and uses google.api_core.retry.AsyncRetry for defining retry policies.
  • Robust Retry Mechanism: The _BidiStreamRetryManager's execute method orchestrates the retry loop, allowing for automatic re-attempting of streaming operations upon retriable exceptions. It supports resuming operations from a previous state and updating state based on responses, ensuring resilience against transient network issues or service unavailability.
  • Comprehensive Unit Tests: Added a new test file test_bidi_stream_retry_manager.py with extensive unit tests for the _BidiStreamRetryManager. These tests cover various scenarios, including successful execution, retries on initial and mid-stream failures, handling of non-retriable errors, and proper behavior when retry deadlines are exceeded.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

All reactions

Sorry, something went wrong.

Uh oh!

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

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Nov 25, 2025
View reviewed changes

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a _BidiStreamRetryManager for handling retries in bidi streaming operations, along with comprehensive unit tests. The overall implementation is solid and well-tested. I have a few suggestions to improve type safety and maintainability in bidi_stream_retry_manager.py, such as adding a missing type hint, making another one more specific, and pointing out the use of an internal attribute from google-api-core which could be a future maintenance risk. Please see my detailed comments.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread google/cloud/storage/_experimental/asyncio/retry/bidi_stream_retry_manager.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/bidi_stream_retry_manager.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/bidi_stream_retry_manager.py Resolved

Uh oh!

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

@Pulkit0110
Pulkit0110 requested a review from chandra-siri November 25, 2025 09:36
@Pulkit0110
Pulkit0110 force-pushed the bidi-reads-retry4 branch 2 times, most recently from a3795a3 to 4f1aa96 Compare December 1, 2025 04:40
@Pulkit0110 Pulkit0110 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 1, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 1, 2025
@chandra-siri chandra-siri added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 3, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 3, 2025
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. size: l Pull request size is large. and removed size: l Pull request size is large. size: m Pull request size is medium. labels Dec 4, 2025
@Pulkit0110
Pulkit0110 force-pushed the bidi-reads-retry4 branch from 8295ed3 to 5027ed4 Compare December 9, 2025 06:10
@Pulkit0110
Pulkit0110 force-pushed the bidi-reads-retry4 branch from 5027ed4 to 96ac8ce Compare December 16, 2025 10:30
@Pulkit0110
Pulkit0110 requested a review from a team as a code owner December 16, 2025 10:30
@product-auto-label product-auto-label Bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Dec 16, 2025
@Pulkit0110
Pulkit0110 force-pushed the bidi-reads-retry4 branch 2 times, most recently from c8da9ac to bea02a5 Compare December 23, 2025 05:43
Pulkit0110 added 5 commits December 24, 2025 05:53
@Pulkit0110
feat(experimental): Add read resumption strategy
4b3d646
@Pulkit0110
add unit tests
1f51e75
@Pulkit0110
resolving comments
53b3350
@Pulkit0110
feat(experimental): Add bidi stream retry manager
2772634
@Pulkit0110
minor change
798d38b
Pulkit0110 added 12 commits December 24, 2025 05:53
@Pulkit0110
integrate retry logic with the MRD
85fc4a7
@Pulkit0110
test scripts
c5333a8
@Pulkit0110
add error handling for open method
df35f02
@Pulkit0110
minor changes
65b3dfd
@Pulkit0110
remove unused imports
2b4c347
@Pulkit0110
update cloudbuild to pull the PR changes
682b92f
@Pulkit0110
rename bidi_reads_test as per the other test files
5f59efa
@Pulkit0110
remove unused import
5a4c168
@Pulkit0110
add conftest modules in noxfile
aad4c2f
@Pulkit0110
minor changes
89017c0
@Pulkit0110
add smarter resumption scenario in integration tests
673c7a1
@Pulkit0110
minor fix
b82987f
@chandra-siri

chandra-siri commented Dec 24, 2025

Copy link
Copy Markdown
Collaborator

/gemini review

All reactions

Sorry, something went wrong.

Uh oh!

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

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Dec 24, 2025
View reviewed changes

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a robust retry manager for bidi streams, which is a significant enhancement for experimental async downloads. The implementation is well-structured, using a strategy pattern to separate the generic retry loop from the read-specific resumption logic. The addition of conformance tests to validate the retry behavior under various fault-injection scenarios is excellent. My review includes a few suggestions to improve maintainability and logging practices, such as replacing print statements with the logging module and addressing code duplication in error handling.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread google/cloud/storage/_experimental/asyncio/async_multi_range_downloader.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/async_multi_range_downloader.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/async_multi_range_downloader.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/reads_resumption_strategy.py Resolved

Uh oh!

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

@Pulkit0110
resolving comments
efe9c1c
@Pulkit0110
Pulkit0110 force-pushed the bidi-reads-retry4 branch from 32d7d6a to efe9c1c Compare December 24, 2025 10:32
chandra-siri
chandra-siri suggested changes Dec 24, 2025
View reviewed changes

@chandra-siri chandra-siri left a comment

Copy link
Copy Markdown
Collaborator

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.

  • General comments
    • convert print into log statements.
    • reduce code duplicates
    • add comments where ever there's non-trivial logic
  • In the internal bug attach screenshots of perf results with and without this change.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread poc_bidi_retry_final.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/bidi_stream_retry_manager.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/bidi_stream_retry_manager.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_media/requests/download.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/async_multi_range_downloader.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/async_multi_range_downloader.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/async_multi_range_downloader.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/reads_resumption_strategy.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/reads_resumption_strategy.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/reads_resumption_strategy.py Resolved

Uh oh!

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

@chandra-siri

chandra-siri commented Dec 24, 2025

Copy link
Copy Markdown
Collaborator

Since it's a large change, can you make the description a little detailed. - https://www.conventionalcommits.org/en/v1.0.0/#examples

Pulkit0110 and chandra-siri reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

@Pulkit0110
resolving comments
f926a9b
@Pulkit0110
Pulkit0110 requested a review from chandra-siri December 25, 2025 15:56
chandra-siri
chandra-siri suggested changes Dec 26, 2025
View reviewed changes
Comment thread google/cloud/storage/_experimental/asyncio/async_read_object_stream.py Resolved

Uh oh!

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

Comment thread google/cloud/storage/_experimental/asyncio/retry/bidi_stream_retry_manager.py Resolved

Uh oh!

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

@Pulkit0110
add more unit tests
080e593
@Pulkit0110
Pulkit0110 requested a review from chandra-siri December 26, 2025 09:29
chandra-siri
chandra-siri approved these changes Dec 26, 2025
View reviewed changes
@Pulkit0110
Pulkit0110 merged commit d90f0ee into googleapis:main Dec 26, 2025
@release-please release-please Bot mentioned this pull request Dec 23, 2025
chore(main): release 3.8.0 #1669
Closed
@vchudnov-g vchudnov-g mentioned this pull request Jan 12, 2026
chore: librarian release pull request: 20260112T135255Z #1701
Closed
@parthea parthea mentioned this pull request Jan 13, 2026
chore: librarian release pull request: 20260113T144551Z #1704
Merged
vchudnov-g added a commit that referenced this pull request Jan 13, 2026
@parthea @vchudnov-g
chore: librarian release pull request: 20260113T144551Z (#1704)
16cf512
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v0.7.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91
<details><summary>google-cloud-storage: 3.8.0</summary>

##
[3.8.0](v3.7.0...v3.8.0)
(2026-01-13)

### Features

* expose persisted size in mrd (#1671)
([0e2961b](0e2961be))

* implement &#34;append_from_file&#34; (#1686)
([1333c95](1333c956))

* compute chunk wise checksum for bidi_writes (#1675)
([139390c](139390cb))

* flush the last chunk in append method (#1699)
([89bfe7a](89bfe7a5))

* add write resumption strategy (#1663)
([a57ea0e](a57ea0ec))

* add bidi stream retry manager. (#1632)
([d90f0ee](d90f0ee0))

* make flush size configurable (#1677)
([f7095fa](f7095faf))

### Bug Fixes

* no state lookup while opening bidi-write stream
([2d5a7b1](2d5a7b16))

* no state lookup while opening bidi-write stream (#1636)
([2d5a7b1](2d5a7b16))

* close write object stream always (#1661)
([4a609a4](4a609a4b))

* add system test for opening with read_handle (#1672)
([6dc711d](6dc711da))

</details>

---------

Co-authored-by: Victor Chudnovsky <[email protected]>
@release-please release-please Bot mentioned this pull request Jan 13, 2026
chore(main): release 3.8.0 #1706
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
@chandra-siri chandra-siri chandra-siri approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

@chandra-siri chandra-siri

Labels

api: storage Issues related to the googleapis/python-storage API. size: xl Pull request size is extra large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

3 participants

@Pulkit0110 @chandra-siri @yoshi-kokoro
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.