Skip to content

Fix test retry on throttling #34786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 2, 2025
Merged

Conversation

akashorabek
Copy link
Collaborator

Fixes: #34736
Successful run example: https://github.com/akashorabek/beam/actions/runs/14753003019
Updated ThrottlingHandler logic based on the new google-api-core release


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@akashorabek akashorabek requested a review from Abacn April 30, 2025 15:44
@@ -54,9 +55,14 @@ def __call__(self, exc):
_LOGGER.warning('cannot inspect the caller stack frame')
return

# next_sleep is one of the arguments in the caller
# sleep_iterator is one of the arguments in the caller
Copy link
Contributor

Choose a reason for hiding this comment

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

I see, the cause of breakage is client change, and we relied on non-public implementation detail on throttlng.

Does the change work with old client library?

Copy link
Contributor

Choose a reason for hiding this comment

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

Old version failed with

>         self.assertGreater(
              container.get_counter(
                  MetricName('gcsio',
                             "cumulativeThrottlingSeconds")).get_cumulative(),
              1)
E             AssertionError: 0 not greater than 1

We'd need to support both, otherwise this means throttling metrics breaks in google-api-core>=2.25.0rc0

Copy link
Contributor

Choose a reason for hiding this comment

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

cc: @shunping

Copy link
Contributor

Choose a reason for hiding this comment

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

We can inspect compatible google-api-core version in ThrottlingHandler constructor, then at runtime decide which approach to use to extract throttling time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree! Let's check the package version before choosing which arg name to access.

I remembered the current approach was the only feasible way to retrieve wait time in an accurate way during my implementation. And I acknowledged it is a bit fragile.

Copy link
Collaborator Author

@akashorabek akashorabek May 2, 2025

Choose a reason for hiding this comment

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

Added functionality for dynamic selection of the arg name depending on the version of google-api-core
Successful run example with google-api-core >= 2.25.0rc0 - https://github.com/akashorabek/beam/actions/runs/14795779558
Successful run example with google-api-core < 2.25.0rc0 - https://github.com/akashorabek/beam/actions/runs/14796135246

Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @jrmccluskey for label python.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@akashorabek akashorabek requested a review from Abacn May 2, 2025 17:03
Copy link
Contributor

@Abacn Abacn left a comment

Choose a reason for hiding this comment

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

Thank you!

@Abacn Abacn merged commit 9fd7d09 into apache:master May 2, 2025
90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Failing Test]: TestGCSIORetry.test_retry_on_throttling failed due to unknown reasons
3 participants