retrying
retrying copied to clipboard
Access to retry_number from decorated method?
I'd like to log the retry attempt_number in the wrapped/decorated method.
Is there any provision to access this from the method being retried?
eg:
@retry(retry_on_exception=retryable_write_exceptions, wrap_exception=True,
wait_exponential_multiplier=10000, wait_exponential_max=600000)
def retry_read(flakey_method):
try:
retval = flakey_method()
except Exception as e:
logger.error('Retry number: {}'.format(**retry_wrappers_attempt_number**))
return retval