Пример #1
0
def _create_nginx_config(serving_env):
    template = _files.read_file(nginx_config_template_file)

    pattern = re.compile(r'%(\w+)%')
    template_values = {
        'NGINX_HTTP_PORT': serving_env.http_port
    }

    config = pattern.sub(lambda x: template_values[x.group(1)], template)

    logger.info('nginx config: \n%s\n', config)

    _files.write_file(nginx_config_file, config)
Пример #2
0
def _create_nginx_config(serving_env):
    """Placeholder docstring"""
    template = _files.read_file(nginx_config_template_file)

    pattern = re.compile(r"%(\w+)%")
    template_values = {
        "NGINX_HTTP_PORT": serving_env.http_port,
        "NGINX_PROXY_READ_TIMEOUT": str(serving_env.model_server_timeout),
    }

    config = pattern.sub(lambda x: template_values[x.group(1)], template)

    logger.info("nginx config: \n%s\n", config)

    _files.write_file(nginx_config_file, config)
Пример #3
0
def test_read_file():
    test.write_json("test", _env.hyperparameters_file_dir)

    assert _files.read_file(_env.hyperparameters_file_dir) == '"test"'
def test_read_file():
    test.write_json('test', _env.hyperparameters_file_dir)

    assert _files.read_file(_env.hyperparameters_file_dir) == '\"test\"'