portage.util.futures.retry module¶
- exception portage.util.futures.retry.RetryError¶
Bases:
portage.exception.PortageException
Raised when retry fails.
- args¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class portage.util.futures.retry._Retry(future, loop, try_max, try_timeout, overall_timeout, delay_func, reraise, func)¶
Bases:
object
- _begin_try()¶
- _cancel_callback(future)¶
- _delay_done()¶
- _overall_timeout_callback()¶
- _retry_error()¶
- _try_done(future)¶
- _try_timeout_callback()¶
- portage.util.futures.retry._retry(loop, try_max, try_timeout, overall_timeout, delay_func, reraise, func, *args, **kwargs)¶
Retry coroutine, used to implement retry decorator.
- Returns
func return value
- Return type
asyncio.Future (or compatible)
- portage.util.futures.retry._retry_wrapper(_loop, try_max, try_timeout, overall_timeout, delay_func, reraise, func, loop=None)¶
Create and return a decorated function.
- portage.util.futures.retry.retry(try_max=None, try_timeout=None, overall_timeout=None, delay_func=None, reraise=False, loop=None)¶
Create and return a retry decorator. The decorator is intended to operate only on a coroutine function.
- Parameters
try_max (int or None) – maximum number of tries
try_timeout (float or None) – number of seconds to wait for a try to succeed before cancelling it, which is only effective if func returns tasks that support cancellation
overall_timeout (float or None) – number of seconds to wait for retires to succeed before aborting, which is only effective if func returns tasks that support cancellation
delay_func (callable) – function that takes an int argument corresponding to the number of previous tries and returns a number of seconds to wait before the next try
reraise (bool) – Reraise the last exception, instead of RetryError
loop (EventLoop) – event loop
- Returns
func decorated with retry support
- Return type
callable