tenacity
tenacity copied to clipboard
error is raised although retry decorater is there
raise RateLimitExceed
stops the program although there is a retry statement. function calls are of a class method with joblib parallel package.
I could not reproduce on a minimal example.
@retry(retry=retry_if_exception_type(RateLimitExceed),
wait=wait_fixed(3),
stop=stop_after_delay(10),
after=after_log(logger, logging.DEBUG))
def api_call():
raise RateLimitExceed
import logging
import tenacity
from tenacity import retry_if_exception_type, stop_after_delay, wait_fixed, after_log
logger = logging.getLogger(__name__)
class RateLimitExceed(Exception):
pass
@tenacity.retry(retry=retry_if_exception_type(RateLimitExceed),
wait=wait_fixed(3),
stop=stop_after_delay(10),
after=after_log(logger, logging.DEBUG))
def api_call():
print("ran")
raise RateLimitExceed
api_call()
I have run this, it tries 5 times, then fails. Is this not what you are getting?