Skip to content

Commit

Permalink
fix: async api call (#4349)
Browse files Browse the repository at this point in the history
  • Loading branch information
xianml authored and frostming committed Feb 1, 2024
1 parent 7c85456 commit 6b88e7a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bentoml_io/client/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from bentoml._internal.utils import async_gen_to_sync
from bentoml.exceptions import BentoMLException
from bentoml_io.api import APIMethod
from bentoml_io.factory import Service

from .http import ClientEndpoint
Expand Down Expand Up @@ -57,6 +58,9 @@ def call(self, __name: str, /, *args: t.Any, **kwargs: t.Any) -> t.Any:
except KeyError:
raise BentoMLException(f"Endpoint {__name} not found") from None
original_func = getattr(self._inner, __name)
if not isinstance(original_func, APIMethod):
raise BentoMLException(f"calling non-api method {__name} is not allowed")
original_func = original_func.func
while isinstance(original_func, functools.partial):
original_func = original_func.func
is_async_func = (
Expand Down

0 comments on commit 6b88e7a

Please sign in to comment.