pyufunc.retry_on_exception#
- pyufunc.retry_on_exception(function=None, *, attempts=3, wait_seconds=0, retry_exceptions=<class 'Exception'>)#
Decorate a function to retry on selected exceptions.
- Parameters:
function – Optional function to decorate.
attempts – Maximum number of attempts.
wait_seconds – Fixed wait time between attempts.
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_on_exception(lambda: "ok", attempts=1) >>> retrying() 'ok'
- Returns:
Decorated callable or decorator.
- Return type:
Callable[…, Any]