From 518ebd6f58e229870151f46dc6f8490d052acb9e Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Mon, 26 Dec 2022 22:30:56 -0800 Subject: [PATCH] chore: revert changes from upstream/main reverted changes: pyproject.toml Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- pyproject.toml | 2 +- src/bentoml/_internal/client/http.py | 7 ++++++- src/bentoml/_internal/server/grpc/servicer/v1/__init__.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0fbc835f3ce..fe09cb5247a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -183,7 +183,7 @@ omit = [ show_missing = true precision = 2 omit = [ - "src/bentoml/__main__.py", + 'src/bentoml/__main__.py', "src/bentoml/io.py", "src/bentoml/serve.py", "src/bentoml/start.py", diff --git a/src/bentoml/_internal/client/http.py b/src/bentoml/_internal/client/http.py index e50682beb61..f093c7bb8b7 100644 --- a/src/bentoml/_internal/client/http.py +++ b/src/bentoml/_internal/client/http.py @@ -17,6 +17,7 @@ from . import Client from .. import io_descriptors as io from ..service import Service +from ...exceptions import RemoteException from ...exceptions import BentoMLException from ..configuration import get_debug_mode from ..service.inference_api import InferenceAPI @@ -62,8 +63,12 @@ def from_url(cls, server_url: str, **kwargs: t.Any) -> HTTPClient: # TODO: SSL and grpc support conn = HTTPConnection(url_parts.netloc) conn.set_debuglevel(logging.DEBUG if get_debug_mode() else 0) - conn.request("GET", "/docs.json") + conn.request("GET", url_parts.path + "/docs.json") resp = conn.getresponse() + if resp.status != 200: + raise RemoteException( + f"Failed to get OpenAPI schema from the server: {resp.status} {resp.reason}:\n{resp.read()}" + ) openapi_spec = json.load(resp) conn.close() diff --git a/src/bentoml/_internal/server/grpc/servicer/v1/__init__.py b/src/bentoml/_internal/server/grpc/servicer/v1/__init__.py index 7fd0366cf37..49ad48b0bcf 100644 --- a/src/bentoml/_internal/server/grpc/servicer/v1/__init__.py +++ b/src/bentoml/_internal/server/grpc/servicer/v1/__init__.py @@ -49,7 +49,7 @@ class BentoServiceImpl(services.BentoServiceServicer): """An asyncio implementation of BentoService servicer.""" async def Call( # type: ignore (no async types) # pylint: disable=invalid-overridden-method - self, + self: services.BentoServiceServicer, request: pb.Request, context: BentoServicerContext, ) -> pb.Response | None: