예제 #1
0
파일: config.py 프로젝트: indrahrp/s4misc
 def _validate_retry_configuration(self, retries):
     if retries is not None:
         for key in retries:
             if key not in ['max_attempts']:
                 raise InvalidRetryConfigurationError(
                     retry_config_option=key)
             if key == 'max_attempts' and retries[key] < 0:
                 raise InvalidMaxRetryAttemptsError(
                     provided_max_attempts=retries[key])
예제 #2
0
 def _validate_retry_configuration(self, retries):
     if retries is not None:
         for key, value in retries.items():
             if key not in ['max_attempts', 'mode', 'total_max_attempts']:
                 raise InvalidRetryConfigurationError(
                     retry_config_option=key)
             if key == 'max_attempts' and value < 0:
                 raise InvalidMaxRetryAttemptsError(
                     provided_max_attempts=value,
                     min_value=0,
                 )
             if key == 'total_max_attempts' and value < 1:
                 raise InvalidMaxRetryAttemptsError(
                     provided_max_attempts=value,
                     min_value=1,
                 )
             if key == 'mode' and value not in [
                     'legacy', 'standard', 'adaptive'
             ]:
                 raise InvalidRetryModeError(provided_retry_mode=value)