Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 3
0
def test_read_file():
    test.write_json("test", _env.hyperparameters_file_dir)

    assert _files.read_file(_env.hyperparameters_file_dir) == '"test"'
Ejemplo n.º 4
0
def test_read_file():
    test.write_json('test', _env.hyperparameters_file_dir)

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