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
Source package:
tenacity.Source repository: jd/tenacity
Source document: https://tenacity.readthedocs.io/en/latest/
Source license: Apache License 2.0.
Example
>>> retrying = retry_with_backoff(lambda: "ok", attempts=1) >>> retrying() 'ok'
- Returns:
Decorated callable or decorator.
- Return type:
Callable[…, Any]