airflow.providers.amazon.aws.executors.utils.exponential_backoff_retry

Module Contents

Functions

calculate_next_attempt_delay(attempt_number[, ...])

Calculate the exponential backoff (in seconds) until the next attempt.

exponential_backoff_retry(last_attempt_time, ...[, ...])

Retry a callable function with exponential backoff between attempts if it raises an exception.

Attributes

log

airflow.providers.amazon.aws.executors.utils.exponential_backoff_retry.log[source]
airflow.providers.amazon.aws.executors.utils.exponential_backoff_retry.calculate_next_attempt_delay(attempt_number, max_delay=60 * 2, exponent_base=4)[source]

Calculate the exponential backoff (in seconds) until the next attempt.

Parameters
  • attempt_number (int) – Number of attempts since last success.

  • max_delay (int) – Maximum delay in seconds between retries. Default 120.

  • exponent_base (int) – Exponent base to calculate delay. Default 4.

airflow.providers.amazon.aws.executors.utils.exponential_backoff_retry.exponential_backoff_retry(last_attempt_time, attempts_since_last_successful, callable_function, max_delay=60 * 2, max_attempts=-1, exponent_base=4)[source]

Retry a callable function with exponential backoff between attempts if it raises an exception.

Parameters
  • last_attempt_time (datetime.datetime) – Timestamp of last attempt call.

  • attempts_since_last_successful (int) – Number of attempts since last success.

  • callable_function (Callable) – Callable function that will be called if enough time has passed.

  • max_delay (int) – Maximum delay in seconds between retries. Default 120.

  • max_attempts (int) – Maximum number of attempts before giving up. Default -1 (no limit).

  • exponent_base (int) – Exponent base to calculate delay. Default 4.

Was this entry helpful?