pyufunc.retry_call#

pyufunc.retry_call(function, *args, attempts=3, wait_seconds=0, retry_exceptions=<class 'Exception'>, **kwargs)#

Call a function with retry attempts.

Parameters:
  • function – Callable to execute.

  • *args – Positional arguments passed to function.

  • attempts – Maximum number of attempts.

  • wait_seconds – Fixed wait time between attempts.

  • retry_exceptions – Exception type or tuple of exception types to retry.

  • **kwargs – Keyword arguments passed to function.

Raises:

BaseException – Re-raises the final exception when retries are exhausted.

Note

Example

>>> retry_call(lambda: "ok")
'ok'
Returns:

Return value from function.

Return type:

Any