def __init__(self,
                 context=None,
                 timeout=None,
                 wait_strategy=None,
                 lambda_time_out_margin=10):
        """
        Initializes retry logic
        :param wait_strategy: Wait strategy that returns retry wait periods
        :param context: Lambda context that is used to calculate remaining execution time
        :param timeout: Timeout for method call. This time can not exceed the remaining time if a method is called
        within the context of a lambda function.
        :param lambda_time_out_margin: If called within the context of a Lambda function this time should at least be 
        remaining before making a retry. This is to allow possible cleanup and logging actions in the remaining time
        """
        AwsApiServiceRetry.__init__(
            self,
            call_retry_strategies=None,
            wait_strategy=wait_strategy,
            context=context,
            timeout=timeout,
            lambda_time_out_margin=lambda_time_out_margin)

        self._call_retry_strategies += [
            self.dynamo_throughput_exceeded, self.dynamo_resource_in_use
        ]
Exemplo n.º 2
0
 def can_retry(self, ex):
     """
        Tests if a retry can be done based on the exception of an earlier call
        :param ex: Execution raise by earlier call of the boto3 method
        :return: True if any of the call_retry_strategy returns True, else False
        """
     if type(ex) == ParamValidationError:
         return False
     return AwsApiServiceRetry.can_retry(self, ex)
Exemplo n.º 3
0
    def __init__(self,
                 context=None,
                 logger=None,
                 timeout=None,
                 wait_strategy=None,
                 lambda_time_out_margin=10):
        AwsApiServiceRetry.__init__(
            self,
            call_retry_strategies=None,
            wait_strategy=wait_strategy,
            context=context,
            timeout=timeout,
            logger=logger,
            lambda_time_out_margin=lambda_time_out_margin)

        self._call_retry_strategies += [
            self.dynamo_throughput_exceeded, self.dynamo_resource_in_use,
            self.dynamo_connection_reset_by_peer
        ]
Exemplo n.º 4
0
    def __init__(self,
                 context=None,
                 logger=None,
                 timeout=None,
                 wait_strategy=None,
                 lambda_time_out_margin=10):
        AwsApiServiceRetry.__init__(
            self,
            call_retry_strategies=None,
            wait_strategy=wait_strategy,
            context=context,
            timeout=timeout,
            logger=logger,
            lambda_time_out_margin=lambda_time_out_margin)

        self._call_retry_strategies += [
            self.snapshot_creation_per_volume_throttles,
            self.resource_limit_exceeded, self.request_limit_exceeded
        ]