def increase_writes_in_units(
        current_provisioning, units, max_provisioned_writes,
        consumed_write_units_percent, log_tag):
    """ Increase the current_provisioning with units units

    :type current_provisioning: int
    :param current_provisioning: The current provisioning
    :type units: int
    :param units: How many units should we increase with
    :returns: int -- New provisioning value
    :type max_provisioned_writes: int
    :param max_provisioned_writes: Configured max provisioned writes
    :type consumed_write_units_percent: float
    :param consumed_write_units_percent: Number of consumed write units
    :type log_tag: str
    :param log_tag: Prefix for the log
    """
    units = int(units)
    current_provisioning = float(current_provisioning)
    consumed_write_units_percent = float(consumed_write_units_percent)
    consumption_based_current_provisioning = \
        int(math.ceil(current_provisioning*(consumed_write_units_percent/100)))

    if consumption_based_current_provisioning > current_provisioning:
        updated_provisioning = consumption_based_current_provisioning + units
    else:
        updated_provisioning = int(current_provisioning) + units

    if max_provisioned_writes > 0:
        if updated_provisioning > max_provisioned_writes:
            logger.info(
                '{0} - Reached provisioned writes max limit: {1}'.format(
                    log_tag,
                    max_provisioned_writes))

            return max_provisioned_writes

    logger.debug(
        '{0} - Write provisioning will be increased to {1:d} units'.format(
            log_tag,
            int(updated_provisioning)))

    return updated_provisioning
def increase_writes_in_units ( current_provisioning , units , max_provisioned_writes , consumed_write_units_percent , log_tag ) : units = int ( units ) current_provisioning = float ( current_provisioning ) consumed_write_units_percent = float ( consumed_write_units_percent ) consumption_based_current_provisioning = int ( math . ceil ( current_provisioning * ( consumed_write_units_percent / 100 ) ) ) if consumption_based_current_provisioning > current_provisioning : updated_provisioning = consumption_based_current_provisioning + units else : updated_provisioning = int ( current_provisioning ) + units if max_provisioned_writes > 0 : if updated_provisioning > max_provisioned_writes : logger . info ( '{0} - Reached provisioned writes max limit: {1}' . format ( log_tag , max_provisioned_writes ) ) return max_provisioned_writes logger . debug ( '{0} - Write provisioning will be increased to {1:d} units' . format ( log_tag , int ( updated_provisioning ) ) ) return updated_provisioning
Increase the current_provisioning with units units

    :type current_provisioning: int
    :param current_provisioning: The current provisioning
    :type units: int
    :param units: How many units should we increase with
    :returns: int -- New provisioning value
    :type max_provisioned_writes: int
    :param max_provisioned_writes: Configured max provisioned writes
    :type consumed_write_units_percent: float
    :param consumed_write_units_percent: Number of consumed write units
    :type log_tag: str
    :param log_tag: Prefix for the log