Skip to content

Conversation

@theacodes
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 17, 2017
Copy link
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

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

Mostly LGTM (thanks for keeping this PR small)

"""Helpers for retrying functions with exponential back-off."""
"""Helpers for retrying functions with exponential back-off.
The :cls`Retry` decorator can be used to retry function that raise exceptions

This comment was marked as spam.

This comment was marked as spam.

predicate (Callable[Exception]): A callable that should return ``True``
if the given exception is retryable.
initial (float): The minimum about of time to delay. This must
be greater than 0.

This comment was marked as spam.

This comment was marked as spam.

predicate=if_transient_error,
initial=1,
maximum=60,
multiplier=2,

This comment was marked as spam.

This comment was marked as spam.

maximum (float): The maximum about of time to delay.
multiplier (float): The multiplier applied to the delay.
jitter (float): The maximum about of randomness to apply to the delay.
deadline (float): How long to keep retrying.

This comment was marked as spam.

This comment was marked as spam.

be greater than 0.
maximum (float): The maximum about of time to delay.
multiplier (float): The multiplier applied to the delay.
jitter (float): The maximum about of randomness to apply to the delay.

This comment was marked as spam.

This comment was marked as spam.

"""
return Retry(
predicate=self._predicate,
initial=initial if initial is not None else self._initial,

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

'<Retry predicate={}, initial={:.1f}, maximum={:.1f}, '
'multiplier={:.1f}, jitter={:.1f}, deadline={:.1f}>'.format(
self._predicate, self._initial, self._maximum,
self._multiplier, self._jitter, self._deadline))

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Aug 17, 2017

LGTM

"""Helpers for retrying functions with exponential back-off."""
"""Helpers for retrying functions with exponential back-off.
The :cls`Retry` decorator can be used to retry functions that raise exceptions

This comment was marked as spam.

maximum (float): The maximum about of time to delay.
multiplier (float): The multiplier applied to the delay.
jitter (float): The maximum about of randomness to apply to the delay.
max_jitter (float): The maximum about of randomness to apply to the

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

return retry_wrapped_func

def with_deadline(self, deadline):
"""Returns a copy of this retry with the given deadline.

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

@lukesneeringer lukesneeringer left a comment

Choose a reason for hiding this comment

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

This looks fine. Only putting "comment" since in Hangouts, @jonparrott suggested he does plan on changing the jitter algorithm.

If you end up deciding to leave it, then LGTM. If you end up deciding to change, it I will re-review once you have.

@theacodes theacodes merged commit 36304f7 into googleapis:master Aug 17, 2017
@theacodes theacodes deleted the api-core-retry-decorator branch August 17, 2017 22:34
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 21, 2017
* Add google.api.core.retry.Retry decorator
* Add futures dependency
* Change jitter algorithm
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
* Add google.api.core.retry.Retry decorator
* Add futures dependency
* Change jitter algorithm
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
* Add google.api.core.retry.Retry decorator
* Add futures dependency
* Change jitter algorithm
parthea pushed a commit that referenced this pull request Nov 24, 2025
* Add google.api.core.retry.Retry decorator
* Add futures dependency
* Change jitter algorithm
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