FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add 'on_error' argument to 'retry.retry_target' and 'Retry'. by tseaver · Pull Request #3891 · googleapis/google-cloud-python · GitHub

Add 'on_error' argument to 'retry.retry_target' and 'Retry'. - #3891

Merged
tseaver merged 3 commits into
googleapis:masterfrom
tseaver:core-retry_target-add-on_error-argument
Aug 29, 2017
Merged

Add 'on_error' argument to 'retry.retry_target' and 'Retry'.#3891
tseaver merged 3 commits into
googleapis:masterfrom
tseaver:core-retry_target-add-on_error-argument

Conversation

tseaver commented Aug 28, 2017

Copy link
Copy Markdown
Contributor

Permit application code to reset / fix-up state before retrying.

See: #3889

Permit application code to reset / fix-up state before retrying.

See:
#3889
tseaver requested a review from theacodes August 28, 2017 20:49
googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 28, 2017

dhermes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM though I think you should let @jonparrott have a look before merging

Comment thread core/google/api/core/retry.py Outdated
sleep_generator (Iterator[float]): An infinite iterator that determines
how long to sleep between retries.
deadline (float): How long to keep retrying the target.
on_error(Callable): A function to call while processing a retryable

This comment was marked as spam.

This comment was marked as spam.

Comment thread core/google/api/core/retry.py Outdated

Args:
func (Callable): The callable to add retry behavior to.
on_error(Callable): A function to call while processing a

This comment was marked as spam.

This comment was marked as spam.

raise ValueError()
return 42

result = retry.retry_target(

This comment was marked as spam.


result = retry.retry_target(
target, predicate, range(10), None, on_error=on_error)

This comment was marked as spam.

This comment was marked as spam.

theacodes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

looks mostly good, just a few questions.

Comment thread core/google/api/core/retry.py Outdated
raise
last_exc = exc
if on_error is not None:
on_error()

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread core/google/api/core/retry.py Outdated
sleep_generator (Iterator[float]): An infinite iterator that determines
how long to sleep between retries.
deadline (float): How long to keep retrying the target.
on_error(Callable): A function to call while processing a retryable

This comment was marked as spam.

This comment was marked as spam.

self._deadline = deadline

def __call__(self, func):
def __call__(self, func, on_error=None):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Copy link
Copy Markdown
Contributor

This is fine to merge once on_error is passed the exc. Then, @tseaver can use it to make #3889 much simpler.

tseaver merged commit 9c4144b into googleapis:master Aug 29, 2017
tseaver deleted the core-retry_target-add-on_error-argument branch August 29, 2017 14:33
parthea pushed a commit that referenced this pull request Nov 24, 2025
Permit application code to reset / fix-up state before retrying.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: core cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL