Exemplo n.º 1
0
def image(clean_context):
    svc = PytorchLightningService()
    model = TorchLightningModelTwo()
    svc.pack('model', model)
    saved_path = svc.save(version=uuid.uuid4().hex[0:8])

    yield clean_context.enter_context(
        build_api_server_docker_image(saved_path))
Exemplo n.º 2
0
def host(clean_context, test_svc_bundle, enable_microbatch, with_docker):
    if with_docker:
        image = clean_context.enter_context(
            build_api_server_docker_image(test_svc_bundle, "example_service"))
        with run_api_server_docker_container(image, enable_microbatch) as host:
            yield host
    else:
        with run_api_server(test_svc_bundle, enable_microbatch) as host:
            yield host
Exemplo n.º 3
0
def host(pytestconfig, clean_context, enable_microbatch):
    test_svc_bundle = pytestconfig.getoption("bento_dist") or os.path.join(
        sys.argv[1], "build", "dist")

    if pytestconfig.getoption("docker"):
        image = clean_context.enter_context(
            build_api_server_docker_image(test_svc_bundle, "example_service"))
        with run_api_server_docker_container(image, enable_microbatch) as host:
            yield host
    else:
        with run_api_server(test_svc_bundle, enable_microbatch) as host:
            yield host
Exemplo n.º 4
0
def host(pytestconfig, clean_context):
    """
    Launch host from a
    """
    test_svc_bundle = pytestconfig.getoption("bento_dist") or os.path.join(
        sys.argv[2], "build", "dist")

    config_file = pytestconfig.getoption("config_file") or os.path.join(
        sys.argv[2], "bentoml_config.yml")
    if not os.path.exists(config_file):
        if pytestconfig.getoption("config_file"):
            raise Exception(f"config file not found: {config_file}")
        else:
            config_file = None

    if pytestconfig.getoption("docker"):
        image = clean_context.enter_context(
            build_api_server_docker_image(test_svc_bundle, "example_service"))
        with run_api_server_docker_container(
                image,
                config_file=config_file,
        ) as host:
            yield host
    elif pytestconfig.getoption("dev_server"):
        with run_api_server(
                test_svc_bundle,
                config_file=config_file,
                dev_server=True,
        ) as host:
            yield host
    else:
        with run_api_server(
                test_svc_bundle,
                config_file=config_file,
        ) as host:
            yield host
def h2o_image(h2o_svc_saved_dir):
    with build_api_server_docker_image(h2o_svc_saved_dir,
                                       "h2o_example_service") as image:
        yield image
def image(svc, clean_context):
    with export_service_bundle(svc) as saved_path:
        yield clean_context.enter_context(build_api_server_docker_image(saved_path))
Exemplo n.º 7
0
def image(test_svc, clean_context):
    with export_service_bundle(test_svc) as bundle_dir:
        yield clean_context.enter_context(
            build_api_server_docker_image(bundle_dir, "example_service"))
def xgboost_image(xgboost_svc_saved_dir):
    with build_api_server_docker_image(xgboost_svc_saved_dir,
                                       "xgboost_example_service") as image:
        yield image
Exemplo n.º 9
0
def transformers_image(transformers_svc_saved_dir):
    with build_api_server_docker_image(transformers_svc_saved_dir,
                                       "tranformers_example_service") as image:
        yield image