sceptre/helpers.py
def exponential_backoff(func):
    """
    Retries a Boto3 call up to 5 times if request rate limits are hit.

    The time waited between retries increases exponentially. If rate limits are
    hit 5 times, exponential_backoff raises a
    :py:class:sceptre.exceptions.RetryLimitExceededException().

    :param func: a function that uses boto calls
    :type func: func
    :returns: The decorated function.
    :rtype: func
    :raises: sceptre.exceptions.RetryLimitExceededException
    """
    logger = logging.getLogger(__name__)

    @wraps(func)
    def decorated(*args, **kwargs):
        max_retries = 5
        attempts = 0
        while attempts < max_retries:
            try:
                return func(*args, **kwargs)
            except ClientError as e:
                if e.response["Error"]["Code"] == "Throttling":
                    logger.error("Request limit exceeded, pausing...")
                    time.sleep(2 ** attempts)
                    attempts += 1
                else:
                    raise e
        raise RetryLimitExceededError(
            "Exceeded request limit {0} times. Aborting.".format(max_retries)
        )

    return decorated

    Retries a Boto3 call up to 5 times if request rate limits are hit.

    The time waited between retries increases exponentially. If rate limits are
    hit 5 times, exponential_backoff raises a
    :py:class:sceptre.exceptions.RetryLimitExceededException().

    :param func: a function that uses boto calls
    :type func: func
    :returns: The decorated function.
    :rtype: func
    :raises: sceptre.exceptions.RetryLimitExceededException
    
Retries a Boto3 call up to 5 times if request rate limits are hit.
The time waited between retries increases exponentially. If rate limits are
hit 5 times, exponential_backoff raises a
Retries a Boto3 call up to 5 times if request rate limits are hit . The time waited between retries increases exponentially . If rate limits are hit 5 times exponential_backoff raises a
def exponential_backoff(func):
    logger = logging.getLogger(__name__)
    @wraps(func)
    def decorated(*args, **kwargs):
        max_retries = 5
        attempts = 0
        while attempts < max_retries:
            try:
                return func(*args, **kwargs)
            except ClientError as e:
                if e.response["Error"]["Code"] == "Throttling":
                    logger.error("Request limit exceeded, pausing...")
                    time.sleep(2 ** attempts)
                    attempts += 1
                else:
                    raise e
        raise RetryLimitExceededError(
            "Exceeded request limit {0} times. Aborting.".format(max_retries)
        )
    return decorated
def exponential_backoff ( func ) : logger = logging . getLogger ( __name__ ) @ wraps ( func ) def decorated ( * args , ** kwargs ) : max_retries = 5 attempts = 0 while attempts < max_retries : try : return func ( * args , ** kwargs ) except ClientError as e : if e . response [ "Error" ] [ "Code" ] == "Throttling" : logger . error ( "Request limit exceeded, pausing..." ) time . sleep ( 2 ** attempts ) attempts += 1 else : raise e raise RetryLimitExceededError ( "Exceeded request limit {0} times. Aborting." . format ( max_retries ) ) return decorated
Retries a Boto3 call up to 5 times if request rate limits are hit.
Retries a Boto3 call up to 5 times if request rate limits are hit .
"""
    Retries a Boto3 call up to 5 times if request rate limits are hit.

    The time waited between retries increases exponentially. If rate limits are
    hit 5 times, exponential_backoff raises a
    :py:class:sceptre.exceptions.RetryLimitExceededException().

    :param func: a function that uses boto calls
    :type func: func
    :returns: The decorated function.
    :rtype: func
    :raises: sceptre.exceptions.RetryLimitExceededException
    """
The decorated function.
The decorated function .
func
None
func
a function that uses boto calls
a function that uses boto calls
py
None