pyrit.exceptions.pyrit_custom_result_retry#
- pyrit_custom_result_retry(retry_function: Callable, retry_max_num_attempts: int = 10) Callable [source]#
A decorator to apply retry logic with exponential backoff to a function.
Retries the function if the result of the retry_function is True, with a wait time between retries that follows an exponential backoff strategy. Logs retry attempts at the INFO level and stops after a maximum number of attempts.
- Parameters:
retry_function (Callable) – The boolean function to determine if a retry should occur based on the result of the decorated function.
retry_max_num_attempts (Optional, int) – The maximum number of retry attempts. Defaults to CUSTOM_RESULT_RETRY_MAX_NUM_ATTEMPTS.
func (Callable) – The function to be decorated.
- Returns:
The decorated function with retry logic applied.
- Return type:
Callable