pyufunc.retry_with_backoff#

pyufunc.retry_with_backoff(function=None, *, attempts=3, min_seconds=1, max_seconds=10, multiplier=1, retry_exceptions=<class 'Exception'>)#

Decorate a function with exponential backoff retry behavior.

Parameters:
  • function – Optional function to decorate.

  • attempts – Maximum number of attempts.

  • min_seconds – Minimum exponential wait in seconds.

  • max_seconds – Maximum exponential wait in seconds.

  • multiplier – Exponential wait multiplier.

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

Note

Example

>>> retrying = retry_with_backoff(lambda: "ok", attempts=1)
>>> retrying()
'ok'
Returns:

Decorated callable or decorator.

Return type:

Callable[…, Any]