navigate.model.device_startup_functions.auto_redial
- navigate.model.device_startup_functions.auto_redial(func: ~typing.Callable[[...], ~typing.Any], args: ~typing.Tuple[~typing.Any, ...], n_tries: int = 10, exception: ~typing.Type[Exception] = <class 'Exception'>, **kwargs: ~typing.Any) → Any
Retries connections to a startup device defined by func for a specified number of attempts.
This function attempts to execute the connection function func up to n_tries times. If an exception occurs, it retries the connection after a brief pause, logging each failure. If the connection partially succeeds, it cleans up any objects before retrying.
- Parameters:
func (Callable[..., Any]) – The function or class (__init__() method) that connects to a device.
args (Tuple[Any, ...]) – Positional arguments to pass to the func.
n_tries (int) – The number of attempts to retry the connection. Default is 10.
exception (Type[Exception]) – The exception type to catch and handle during connection attempts. Default is Exception.
**kwargs (Any) – Additional keyword arguments passed to func.
- Returns:
The result of the successful execution of func.
- Return type:
Any
- Raises:
exception – If all connection attempts fail, the specified exception is raised.