Uh oh!
There was an error while loading. Please reload this page.
Add google.api.core.retry.Retry decorator - #3835
Conversation
dhermes
left a comment
There was a problem hiding this comment.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| predicate=if_transient_error, | ||
| initial=1, | ||
| maximum=60, | ||
| multiplier=2, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| """ | ||
| 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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| '<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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
lukesneeringer
left a comment
There was a problem hiding this comment.
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.
* Add google.api.core.retry.Retry decorator * Add futures dependency * Change jitter algorithm
* Add google.api.core.retry.Retry decorator * Add futures dependency * Change jitter algorithm
* Add google.api.core.retry.Retry decorator * Add futures dependency * Change jitter algorithm
* Add google.api.core.retry.Retry decorator * Add futures dependency * Change jitter algorithm
No description provided.