util package¶
Subpackages¶
Submodules¶
util.active_warnings module¶
-
class
util.active_warnings.
ActiveError
(error)¶ Bases:
object
This class represents an active error.
-
class
util.active_warnings.
ActiveWarning
(warning, description=None)¶ Bases:
object
This class represents an active warning.
util.apps module¶
Defines the application configuration for the util application
util.aws module¶
Utility functions for testing AWS credentials and access to required resources
-
class
util.aws.
AWSClient
(resource, config, credentials=None, region_name=None)¶ Bases:
object
Manages automatically creating and destroying clients to AWS services.
-
static
instantiate_credentials_from_config
(config)¶ Extract credential keys from configuration and return instantiated credential object
If values provided in the access_key_id or secret_access_key keys of credentials configuration object are empty, None will be returned. In this case, role-based authentication should be attempted.
Parameters: config ( botocore.client.Config
) – Resource specific configurationReturns: instantiated credential object or None if keys provided were empty Return type: util.aws.AWSCredentials
:raises
util.exceptions.InvalidAWSCredentials
: If the credentials provided are incomplete.
-
static
-
class
util.aws.
AWSCredentials
(access_key_id, secret_access_key)¶ Bases:
tuple
-
access_key_id
¶ Alias for field number 0
-
secret_access_key
¶ Alias for field number 1
-
-
class
util.aws.
S3Client
(credentials=None, region_name=None)¶ Bases:
util.aws.AWSClient
-
get_bucket
(bucket_name, validate=True)¶ Gets a reference to an S3 bucket with the given identifier.
Parameters: - bucket_name (string) – The unique name of the bucket to retrieve.
- validate (bool) – Whether to perform a request that verifies the bucket actually exists.
Returns: The bucket object for the given name.
Return type: boto3.s3.Bucket
:raises
botocore.exceptions.ClientError
: If the bucket fails to validate.
-
get_object
(bucket_name, key_name, validate=True)¶ Gets a reference to an S3 object with the given identifier.
Parameters: - bucket_name (string) – The unique name of the bucket to retrieve.
- key_name (string) – The unique name of the object to retrieve that is associated with a file.
- validate (bool) – Whether to perform a request that verifies the object actually exists.
Returns: The S3 object for the given name.
Return type: boto3.s3.Object
:raises
botocore.exceptions.ClientError
: If the request is invalid. :raisesstorage.exceptions.FileDoesNotExist
: If the file is not found in the bucket.
-
list_objects
(bucket_name, recursive=False, prefix=None)¶ Generator function to retrieve list of objects within an S3 bucket
Retrieval of objects is provided by the boto3 paginator over list_objects. This allows for simple paging support with unbounded object counts. As a result of the time that may be required for the full result set to be returned, the results are returned via a generator. This generator will contain objects of type storage.brokers.broker.FileDetails.
Parameters: - bucket_name (string) – The unique name of the bucket to retrieve.
- recursive (bool) – Whether the bucket should be recursively searched from the given prefix
- prefix (string) – The parent key from which to search bucket. Trailing slash is optional
Returns: Generator of S3 objects that were found.
Return type: Generator[
storage.brokers.broker.FileDetails
]
-
-
class
util.aws.
SQSClient
(credentials=None, region_name=None)¶ Bases:
util.aws.AWSClient
-
get_queue_by_name
(queue_name)¶ Gets a SQS queue by the given name
Parameters: queue_name (string) – The unique name of the SQS queue Returns: Queue resource to perform queue operations Return type: boto3.sqs.Queue
-
get_queue_size
(queue_name)¶ Gets the size of the SQS queue by the given name
Parameters: queue_name (string) – The unique name of the SQS queue Returns: approximate number of messages in the queue Return type: int
-
receive_messages
(queue_name, batch_size=100, wait_time_seconds=20, visibility_timeout_seconds=30)¶ Receive a batch of messages from an SQS queue
Parameters: - queue_name –
- batch_size (int) – Number of messages to retrieve in a single pass
- wait_time_seconds (int) – Long-poll duration of request (max of 20). Ends immediately when message published.
- visibility_timeout_seconds (int) – Duration for a message to be hidden after retrieved from the queue.
Returns: Generator of messages
Return type: Generator[boto3.sqs.Message]
-
send_message
(queue_name, message)¶ Send a message to SQS queue.
Parameters: - queue_name (string) – The unique name of the SQS queue
- message (string) – Message to send to SQS queue
-
send_messages
(queue_name, messages)¶ Send a batch of messages to SQS queue.
Parameters: - queue_name (string) – The unique name of the SQS queue
- messages ([SendMessageBatchRequestEntry]) – Messages to send to SQS queue
-
util.broker module¶
-
class
util.broker.
BrokerDetails
¶ Bases:
object
-
static
from_broker_url
(broker_url)¶ Construct a BrokerDetails object from a broker URL
Parameters: broker_url (string) – URL containing connection information to message broker Returns: Instantiated object containing details within broker URL Return type:
-
get_address
()¶ Get extracted broker host and port or region depending on backend type
Returns: Broker host and port or region of backend Return type: string
-
get_password
()¶ Get extracted password for broker authentication.
May be None if credentials are not specified in broker URL.
Returns: Password for broker authentication Return type: string or None
-
get_type
()¶ Get the transport broker type defined in URL
Returns: Transport type for broker connection Return type: string
-
get_user_name
()¶ Get extracted user name for broker authentication.
May be None if credentials are not specified in broker URL.
Returns: User name for broker authentication Return type: string or None
-
get_virtual_host
()¶ Get extracted virtual host of broker backend
May be None if virtual host is not specified in broker URL
Returns: Virtual host for broker connection Return type: string or None
-
static
util.command module¶
Defines utility functions for executing commands on the command line.
-
exception
util.command.
CommandError
(msg, returncode=None)¶ Bases:
exceptions.Exception
-
util.command.
environment_expansion
(env_map, cmd_string, remove_extras=False)¶ Performs environment variable expansion into command string
The original preference was to use bash directly, eliminating the need for us to maintain regular expressions to mimic bash expansion logic. Unfortunately, the overhead of instantiating a sub-shell was prohibitively high on a large scale.
We are instead handling merely a subset of expansion options: $VAR ${VAR} ${VAR/#/PREFIX}
WARNING: Resulting string should be treated as sensitive, due to the possibility of secrets being injected.
Parameters: - env_map (dict) – map of environment variables to their values
- cmd_string (str) – string to inject environment variables into
- remove_extras (bool) – whether to remove extra parameters that do not have a value
Returns: string with parameters expanded
Return type: str
:raises
util.exceptions.UnbalancedBrackets
: if brackets are not balanced in cmd_string
-
util.command.
execute_command_line
(cmd_list)¶ Executes the given command list on the command line
Parameters: cmd_list ([]) – The list of commands
util.database module¶
Helper methods for os operations
-
util.database.
alphabetize
(order, fields)¶ Returns the correct sort order
Parameters:
-
util.database.
sleep
(the_model, the_id)¶ Sleeps for a maximum of 5 seconds while waiting for an object to become available :param the_class: The model we’re trying to find :type the_model: Class :param the_id: The id of the object we’re trying to find :type the_id: int
util.dcos module¶
-
util.dcos.
make_dcos_request
(host_address, relative_url, params=None)¶ Makes a requests that is capable of traversing DCOS EE Strict boundary
Parameters: - master (util.host.HostAddress) – The address for the Mesos master
- relative_url (basestring) – URL path relative to the base address
- params (dict) – The query parameters for request
Returns: The request response object
Return type: requests.Response
util.deprecation module¶
util.environment module¶
-
util.environment.
normalize_env_var_name
(name)¶ Returns a normalized version of the given string name so it can be used as the name of an environment variable
Parameters: name (string) – The string name to normalize Returns: The normalized environment variable name Return type: string
util.exceptions module¶
Defines utility exceptions
-
exception
util.exceptions.
FileDoesNotExist
¶ Bases:
exceptions.Exception
Exception indicating an attempt was made to access a file that no longer exists
-
exception
util.exceptions.
InvalidAWSCredentials
¶ Bases:
exceptions.Exception
Exception indicating missing credentials required to successfully authenticate to AWS
-
exception
util.exceptions.
InvalidBrokerUrl
¶ Bases:
exceptions.Exception
Exception indicating the broker URL does not meet the format requirements
-
exception
util.exceptions.
RollbackTransaction
¶ Bases:
exceptions.Exception
Exception that can be thrown and swallowed to explicitly rollback a transaction
-
exception
util.exceptions.
ScaleLogicBug
¶ Bases:
exceptions.Exception
Exception that indicates a critical Scale logic bug has occurred
-
exception
util.exceptions.
ServiceAccountAuthFailure
¶ Bases:
exceptions.Exception
Exception indicating failure of request to login or communicate with DCOS using service account
-
exception
util.exceptions.
TerminatedCommand
¶ Bases:
exceptions.Exception
Exception that can be thrown to indicate that a Scale command recieved a SIGTERM signal
-
exception
util.exceptions.
UnbalancedBrackets
¶ Bases:
exceptions.Exception
Exception thrown when a string is provided that contains unbalanced curly brackets
-
exception
util.exceptions.
ValidationException
(name, description)¶ Bases:
exceptions.Exception
Exception indicating there was a validation error
util.file_size module¶
Defines a utility method for displaying file sizes
-
util.file_size.
file_size_to_string
(file_size)¶ Returns the given file size as a human-readable string
Parameters: file_size (long) – The file size Returns: The human-readable string Return type: string
util.host module¶
Defines the named tuple for host locations
-
class
util.host.
HostAddress
(hostname, port, protocol)¶ Bases:
tuple
-
hostname
¶ Alias for field number 0
-
port
¶ Alias for field number 1
-
protocol
¶ Alias for field number 2
-
-
util.host.
host_address_from_mesos_url
(url)¶ Extract URL components from a Mesos Master URL
Must include the protocol prefix. Ports may be omitted.
Parameters: url (basestring) – The URL to parse Returns: Parsed URL components Return type: util.host.HostAddress
util.lock module¶
Defines a lock that logs activity for deadlock debugging
util.middleware module¶
Common middleware classes used in the web server configuration.
-
class
util.middleware.
ExceptionLoggingMiddleware
(get_response)¶ Bases:
object
-
process_exception
(request, exception)¶ Logs exceptions during service calls.
-
-
class
util.middleware.
MultipleProxyMiddleware
(get_response)¶ Bases:
object
Rewrites the proxy headers so that only the first the proxy forwarded host is used.
By default Django, does not support forwarding the server host name when sitting behind multiple proxy servers. Without this middleware the host name returned to the client will contain both proxy names delimited by a comma, which will not redirect properly. The original example code this class was based on used the host header value from the most recent proxy server. Since the first proxy server in our infrastructure is the host name used by external users however, we want to always take that name instead.
Code derived from the Django documentation for “Request and response objects”, HttpRequest.get_host() method.
-
FORWARDED_FOR_FIELDS
= ['HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED_HOST', 'HTTP_X_FORWARDED_SERVER']¶
-
util.parse module¶
Defines utility functions for parsing data.
-
util.parse.
datetime_to_string
(value)¶ Converts the given datetime into an appropriate ISO-8601 string format for JSON
Parameters: value ( datetime.datetime
) – The datetime to convertReturns: The ISO-8601 string format Return type: string
-
util.parse.
duration_to_string
(value)¶ Converts the given timedelta into an appropriate ISO-8601 duration format for JSON. Only handles positive durations correctly. Fractional seconds are rounded.
Parameters: value ( datetime.timedelta
) – The timedelta to convertReturns: The ISO-8601 duration format Return type: string
-
util.parse.
parse_datetime
(value)¶
-
util.parse.
parse_duration
(value)¶ Parses a duration string and returns a datetime.timedelta. Unlike the standard Django 1.8 function, this only accepts ISO 8601 durations.
-
util.parse.
parse_timestamp
(value)¶ Parses any valid ISO date/time, duration, or timestamp.
Parameters: value (str) – The raw string value to parse. Returns: The result of parsing the given string value. Return type: datetime.datetime
util.rest module¶
Defines utilities for building RESTful APIs.
-
exception
util.rest.
BadParameter
(detail=None, code=None)¶ Bases:
rest_framework.exceptions.APIException
Exception indicating a REST API call contains an invalid value or a missing required parameter.
-
status_code
= 400¶
-
-
class
util.rest.
DefaultPagination
¶ Bases:
rest_framework.pagination.PageNumberPagination
Default configuration class for the paging system.
-
max_page_size
= 1000¶
-
page_size
= 100¶
-
page_size_query_param
= u'page_size'¶
-
-
class
util.rest.
ModelIdSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
rest_framework.serializers.Serializer
Converts a model to a lightweight place holder object with only an identifier to REST output
-
class
util.rest.
PlainTextRenderer
¶ Bases:
rest_framework.renderers.BaseRenderer
Encodes a string using the requested character set and renders it as text/plain.
-
format
= u'txt'¶
-
media_type
= u'text/plain'¶
-
render
(data, media_type=None, renderer_context=None)¶
-
-
exception
util.rest.
ReadOnly
(detail=None, code=None)¶ Bases:
rest_framework.exceptions.APIException
Exception indicating a REST API call is attempting to update a field that does not support it.
-
status_code
= 400¶
-
-
class
util.rest.
ScaleAPIPermissions
¶ Bases:
rest_framework.permissions.BasePermission
Verifies that method is permitted to be called. Evaluation logic is all methods must be authenticated if PUBLIC_API_READ is False SAFE_METHODS will be allowed publicly if PUBLIC_API_READ is True POST against validation methods do not require staff user. Unsafe methods always require staff user.
-
has_permission
(request, view)¶
-
Bases:
rest_framework.exceptions.APIException
-
util.rest.
check_time_range
(started, ended, max_duration=None)¶ Checks whether the given time range is valid.
Parameters: - started (datetime.datetime or None) – The start of a time range.
- ended (datetime.datetime or None) – The end of a time range.
- max_duration (datetime.timedelta) – The maximum amount of time between the started and ended range.
Returns: True when the time range is valid.
Return type: bool
:raises
util.rest.BadParameter
: If there is a problem with the time range.
-
util.rest.
check_together
(names, values)¶ Checks whether a list of fields as a group. Either all or none of the fields should be provided.
Parameters: - names ([string]) – The list of field names to check.
- values ([object]) – The list of field values to check.
Returns: True when all parameters are provided and false if none of the parameters are provided.
Return type: bool
:raises
util.rest.BadParameter
: If the list of fields is mismatched.
-
util.rest.
check_update
(request, fields)¶ Checks whether the given request includes fields that are not allowed to be updated.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - fields ([string]) – A list of field names that are permitted.
Returns: True when the request does not include extra fields.
Return type: bool
:raises
util.rest.ReadOnly
: If the request includes unsupported fields to update. :raisesexceptions.AssertionError
: If fields in not a list or None.- request (
-
util.rest.
get_relative_days
(days)¶ Calculates a relative date/time in the past without any time offsets.
This is useful when a service wants to have a default value of, for example 7 days back. If an ISO duration format is used, such as P7D then the current time will be factored in which results in the earliest day being incomplete when computing an absolute time stamp.
Parameters: days (int) – The number of days back to calculate from now. Returns: An absolute time stamp that is the complete range of relative days back. Return type: datetime.datetime
-
util.rest.
get_url
(path)¶ Builds an absolute URL from the given path with any required prefixes, such as the default REST API version.
Parameters: path (string) – A URL path to combine with the default prefix. Returns: The absolute path to use when calling the target URL path. Return type: string
-
util.rest.
get_versioned_urls
(apps)¶ Generates a list of URLs for applications with REST APIs
Parameters: apps ([string]) – A list of application names to register. Returns: A list of URLs for REST APIs with version prefixes. Return type: [ django.core.urlresolvers.RegexURLPattern
]
-
util.rest.
has_params
(request, *names)¶ Checks whether one or more parameters are included in the request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - names (string) – One or more parameter names to check.
Returns: True when all the parameters are provided or false if at least one is not provided.
Return type: bool
- request (
-
util.rest.
login_client
(client, is_staff=False, username=u'test')¶ Takes a client object and creates a login session, optionally creating a staff user for unsafe methods
-
util.rest.
parse_bool
(request, name, default_value=None, required=True)¶ Parses a bool parameter from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (bool) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
Returns: The value of the named parameter or the default value if provided.
Return type: bool
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
parse_datetime
(request, name, default_value=None, required=True)¶ Parses a datetime parameter from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (datetime.datetime) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
Returns: The value of the named parameter or the default value if provided.
Return type: datetime.datetime
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
parse_dict
(request, name, default_value=None, required=True)¶ Parses a dictionary parameter from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (dict) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
Returns: The value of the named parameter or the default value if provided.
Return type: dict
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
parse_dict_list
(request, name, default_value=None, required=True)¶ Parses a list of dictionary parameters from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (dict) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
Returns: The value of the named parameter or the default value if provided.
Return type: [dict]
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
parse_duration
(request, name, default_value=None, required=True)¶ Parses a time duration parameter from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (datetime.timedelta or string) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
Returns: The value of the named parameter or the default value if provided.
Return type: datetime.timedelta
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
parse_float
(request, name, default_value=None, required=True, accepted_values=None)¶ Parses a floating point parameter from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (float) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
- accepted_values ([float]) – A list of values that are acceptable for the parameter.
Returns: The value of the named parameter or the default value if provided.
Return type: float
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
parse_int
(request, name, default_value=None, required=True, accepted_values=None)¶ Parses an integer parameter from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (int) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
- accepted_values ([int]) – A list of values that are acceptable for the parameter.
Returns: The value of the named parameter or the default value if provided.
Return type: int
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
parse_int_list
(request, name, default_value=None, required=True, accepted_values=None)¶ Parses a list of int parameters from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value ([int]) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
- accepted_values ([int]) – A list of values that are acceptable for the parameter.
Returns: The values of the named parameter or the default values if provided.
Return type: [int]
:raises
util.rest.BadParameter
: If the value cannot be parsed or does not match the validation list.- request (
-
util.rest.
parse_string
(request, name, default_value=None, required=True, accepted_values=None)¶ Parses a string parameter from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (string) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
- accepted_values ([string]) – A list of values that are acceptable for the parameter.
Returns: The value of the named parameter or the default value if provided.
Return type: string
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
parse_string_list
(request, name, default_value=None, required=True, accepted_values=None)¶ Parses a list of string parameters from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value ([string]) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
- accepted_values ([string]) – A list of values that are acceptable for the parameter.
Returns: The values of the named parameter or the default values if provided.
Return type: [string]
:raises
util.rest.BadParameter
: If the value cannot be parsed or does not match the validation list.- request (
-
util.rest.
parse_timestamp
(request, name, default_value=None, required=True)¶ Parses any valid ISO datetime, duration, or timestamp parameter from the given request.
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - name (string) – The name of the parameter to parse.
- default_value (datetime.datetime or datetime.timedelta or string) – The name of the parameter to parse.
- required (bool) – Indicates whether or not the parameter is required. An exception will be raised if the parameter does not exist, there is no default value, and required is True.
Returns: The value of the named parameter or the default value if provided.
Return type: datetime.datetime
:raises
util.rest.BadParameter
: If the value cannot be parsed.- request (
-
util.rest.
strip_schema_version
(json_dict)¶ Returns the given JSON dict after stripping its schema version out
Parameters: json_dict (dict) – The JSON dict Returns: The JSON dict with its schema version stripped out Return type: dict
-
util.rest.
title_to_basename
(title)¶ Generates an identifying basename for a model from a human readable title
Parameters: title (string) – The title to convert Returns: The generated identifying name. Return type: string
-
util.rest.
title_to_name
(queryset, title)¶ Generates an identifying name for a model from a human readable title
Parameters: - request (
rest_framework.request.Request
) – The context of an active HTTP request. - title (string) – The title to convert
Returns: The generated identifying name.
Return type: string
:raises
Exception
: If unable to generate a unique name.- request (
util.retry module¶
Defines decorators for performing function retries with exponential backoff
-
util.retry.
retry
(no_arg_func=None, ex_class=<type 'exceptions.Exception'>, max_tries=3, base_ms_delay=1000, max_ms_delay=30000)¶ Wraps the decorated function so that it is retried with exponential backoff. On the first retry, the delay is a random number of milliseconds between 0 and base_ms_delay. The upper bound is then doubled for each successive retry. A retry delay will not exceed max_ms_delay milliseconds.
Parameters: - no_arg_func (function) – The function to retry (only populated if decorator used without args)
- ex_class (class or tuple of classes) – The exception(s) that should cause the function to retry
- max_tries (int) – The maximum number of times to call the function
- base_ms_delay (int) – The base time to delay in milliseconds before retrying the function
- max_ms_delay (int) – The maximum time to delay in milliseconds
-
util.retry.
retry_database_query
(no_arg_func=None, max_tries=5, base_ms_delay=1000, max_ms_delay=30000)¶ Wraps the decorated function so that it is retried with exponential backoff if any operational database errors (disconnect, too many connections, etc) occurs. On the first retry, the delay is a random number of milliseconds between 0 and base_ms_delay. The upper bound is then doubled for each successive retry. A retry delay will not exceed max_ms_delay milliseconds.
Parameters: - no_arg_func (function) – The function to retry (only populated if decorator used without args)
- max_tries (int) – The maximum number of times to call the function
- base_ms_delay (int) – The base time to delay in milliseconds before retrying the function
- max_ms_delay (int) – The maximum time to delay in milliseconds
util.validation module¶
Defines classes related to validating