original_docstring: Decorator to retry on exception (with exponential backoff).
  
      Args:
        num_retries: maximum number of retries or None to retry forever.
        exception_type: exception class to catch and retry on.
        min_sleep: seconds to sleep between reties minimum.
        max_sleep: seconds to sleep between retries maximum.
      
docstring: Decorator to retry on exception (with exponential backoff).
docstring_tokens: Decorator to retry on exception ( with exponential backoff ) .
code: def retry_on_error(self, num_retries, exception_type,
                       min_sleep=1, max_sleep=600):  # pragma: no cover
      """Decorator to retry on exception (with exponential backoff).
  
      Args:
        num_retries: maximum number of retries or None to retry forever.
        exception_type: exception class to catch and retry on.
        min_sleep: seconds to sleep between reties minimum.
        max_sleep: seconds to sleep between retries maximum.
      """
      def _real_decorator(fn):
        @functools.wraps(fn)
        def _wrapper(*args, **kwargs):
          tries = 0
          cur_sleep = min_sleep
          while True:
            tries += 1
            try:
              return fn(*args, **kwargs)
            except exception_type as e:  # pragma: no cover
              LOGGER.exception('Ran into exception %s', str(e))
              if num_retries is not None and tries > num_retries:
                LOGGER.error('It was the last attempt')
                raise
            LOGGER.info('Sleeping for %d seconds...', cur_sleep)
            self.sleep(cur_sleep)
            cur_sleep = min(cur_sleep * 2, max_sleep) + random.uniform(0, 1)
        return _wrapper
      return _real_decorator
code_tokens: def retry_on_error ( self , num_retries , exception_type , min_sleep = 1 , max_sleep = 600 ) : def _real_decorator ( fn ) : @ functools . wraps ( fn ) def _wrapper ( * args , ** kwargs ) : tries = 0 cur_sleep = min_sleep while True : tries += 1 try : return fn ( * args , ** kwargs ) except exception_type as e : LOGGER . exception ( 'Ran into exception %s' , str ( e ) ) if num_retries is not None and tries > num_retries : LOGGER . error ( 'It was the last attempt' ) raise LOGGER . info ( 'Sleeping for %d seconds...' , cur_sleep ) self . sleep ( cur_sleep ) cur_sleep = min ( cur_sleep * 2 , max_sleep ) + random . uniform ( 0 , 1 ) return _wrapper return _real_decorator
short_docstring: Decorator to retry on exception (with exponential backoff).
short_docstring_tokens: Decorator to retry on exception ( with exponential backoff ) .
comment: # pragma: no cover$SEP$"""Decorator to retry on exception (with exponential backoff).
  
      Args:
        num_retries: maximum number of retries or None to retry forever.
        exception_type: exception class to catch and retry on.
        min_sleep: seconds to sleep between reties minimum.
        max_sleep: seconds to sleep between retries maximum.
      """$SEP$# pragma: no cover