I needed to know how many retries a function made.
I used the example in the doc (v9.0.0):
from tenacity import *
@retry(stop=stop_after_attempt(3))
def raise_my_exception():
raise Exception("Fail")
try:
raise_my_exception()
except Exception as e:
print(e)
pass
print(raise_my_exception.retry.statistics)
when executing:
RetryError[<Future at 0x7ffb5b7902d0 state=finished raised Exception>]
{}
statistics are empty
I was expecting
I needed to know how many retries a function made.
I used the example in the doc (v9.0.0):
when executing:
statistics are empty
I was expecting
{ "attempt_number" : 3 }