Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(serve): update options for triton_options #3503

Merged
merged 3 commits into from
Feb 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/bentoml/bentos.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import sys
import typing as t
import logging
import itertools
import subprocess
from typing import TYPE_CHECKING

from simple_di import inject
from simple_di import Provide
Expand All @@ -21,7 +21,7 @@
from ._internal.bento.build_config import BentoBuildConfig
from ._internal.configuration.containers import BentoMLContainer

if TYPE_CHECKING:
if t.TYPE_CHECKING:
from ._internal.bento import BentoStore
from ._internal.server.server import ServerHandle

Expand Down Expand Up @@ -446,6 +446,8 @@ def serve(
enable_channelz: bool = Provide[BentoMLContainer.grpc.channelz.enabled],
max_concurrent_streams: int
| None = Provide[BentoMLContainer.grpc.max_concurrent_streams],
grpc_protocol_version: str | None = None,
triton_args: t.List[str] | None = None,
) -> ServerHandle:
from .serve import construct_ssl_args
from ._internal.server.server import ServerHandle
Expand Down Expand Up @@ -515,4 +517,17 @@ def serve(
if max_concurrent_streams is not None:
args.extend(["--max-concurrent-streams", str(max_concurrent_streams)])

if grpc_protocol_version is not None:
assert (
server_type == "grpc"
), f"'grpc_protocol_version' should only be passed to gRPC server, got '{server_type}' instead."
args.extend(["--protocol-version", str(grpc_protocol_version)])

if triton_args is not None:
args.extend(
itertools.chain.from_iterable(
[("--triton-options", arg) for arg in triton_args]
)
)

return ServerHandle(process=subprocess.Popen(args), host=host, port=port)