def inconsistencies_detected(e): if get_error_code(e) == 'InvalidGroup.NotFound': return True m = get_error_message(e).lower() matches = ('invalid iam instance profile' in m) or ('no associated iam roles' in m) return matches
def retryable_s3_errors(e): return (connection_reset(e) or (isinstance(e, BotoServerError) and e.status in (429, 500)) or (isinstance(e, BotoServerError) and e.code in THROTTLED_ERROR_CODES) # boto3 errors or (isinstance(e, (S3ResponseError, ClientError)) and get_error_code(e) in THROTTLED_ERROR_CODES) or (isinstance(e, ClientError) and 'BucketNotEmpty' in str(e)) or (isinstance(e, ClientError) and e.response.get('ResponseMetadata', {}).get('HTTPStatusCode') == 409 and 'try again' in str(e)) or (isinstance(e, ClientError) and e.response.get('ResponseMetadata', {}).get('HTTPStatusCode') in (404, 429, 500, 502, 503, 504)))
def retryable_s3_errors(e: Exception) -> bool: """ Return true if this is an error from S3 that looks like we ought to retry our request. """ return (connection_reset(e) or (isinstance(e, BotoServerError) and e.status in (429, 500)) or (isinstance(e, BotoServerError) and e.code in THROTTLED_ERROR_CODES) # boto3 errors or (isinstance(e, (S3ResponseError, ClientError)) and get_error_code(e) in THROTTLED_ERROR_CODES) or (isinstance(e, ClientError) and 'BucketNotEmpty' in str(e)) or (isinstance(e, ClientError) and e.response.get( 'ResponseMetadata', {}).get('HTTPStatusCode') == 409 and 'try again' in str(e)) or (isinstance(e, ClientError) and e.response.get('ResponseMetadata', {}).get('HTTPStatusCode') in (404, 429, 500, 502, 503, 504)))
def not_found(e): try: return get_error_code(e).endswith('.NotFound') except ValueError: # Not the right kind of error return False
def spot_request_not_found(e): return get_error_code(e) == 'InvalidSpotInstanceRequestID.NotFound'