tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

error is raised although retry decorater is there

Open chanansh opened this issue 2 years ago • 2 comments

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

chanansh avatar Mar 02 '22 08:03 chanansh

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?

bcmyguest1 avatar Jun 20 '22 22:06 bcmyguest1