Example #1
0
def _generate_mms_config_properties():
    env = environment.Environment()

    user_defined_configuration = {
        'default_response_timeout': env.model_server_timeout,
        'default_workers_per_model': env.model_server_workers,
        'inference_address':
        'http://0.0.0.0:{}'.format(env.inference_http_port),
        'management_address':
        'http://0.0.0.0:{}'.format(env.management_http_port)
    }

    custom_configuration = str()

    for key in user_defined_configuration:
        value = user_defined_configuration.get(key)
        if value:
            custom_configuration += '{}={}\n'.format(key, value)

    if ENABLE_MULTI_MODEL:
        default_configuration = utils.read_file(MME_MMS_CONFIG_FILE)
    else:
        default_configuration = utils.read_file(DEFAULT_MMS_CONFIG_FILE)

    return default_configuration + custom_configuration
def _generate_mms_config_properties():
    env = environment.Environment()

    user_defined_configuration = {
        "default_response_timeout": env.model_server_timeout,
        "default_workers_per_model": env.model_server_workers,
        "inference_address":
        "http://0.0.0.0:{}".format(env.inference_http_port),
        "management_address":
        "http://0.0.0.0:{}".format(env.management_http_port),
        "vmargs": "-XX:-UseContainerSupport",
    }

    custom_configuration = str()

    for key in user_defined_configuration:
        value = user_defined_configuration.get(key)
        if value:
            custom_configuration += "{}={}\n".format(key, value)

    if ENABLE_MULTI_MODEL:
        default_configuration = utils.read_file(MME_MMS_CONFIG_FILE)
    else:
        default_configuration = utils.read_file(DEFAULT_MMS_CONFIG_FILE)

    return default_configuration + custom_configuration
Example #3
0
def test_read_file(with_open):
    path = Mock()

    result = read_file(path)

    with_open.assert_called_once_with(path, "r")
    with_open().read.assert_called_once_with()
    assert TEXT == result
Example #4
0
def test_read_file_mode(with_open):
    path = Mock()
    mode = Mock()

    result = read_file(path, mode)

    with_open.assert_called_once_with(path, mode)
    with_open().read.assert_called_once_with()
    assert result == TEXT