energia.utils.modeling#
Utilities for modeling
Functions
|
Retry a function a number of times if it raises specified exceptions. |
- retry(func, attempts: int = 2, exceptions=(<class 'Exception'>, ))[source]#
Retry a function a number of times if it raises specified exceptions.
- Parameters:
func (callable) – The function to retry.
attempts (int) – Number of attempts.
exceptions (tuple[Exception]) – Exceptions to catch and retry on.
- Returns:
The result of the function if successful.