You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm following the docs on how to use a GRPC client
from __future__ import annotations
import asyncio
import logging
import numpy as np
import bentoml
async def async_run(client: bentoml.client.Client):
res = await client.async_classify(np.array([[5.9, 3, 5.1, 1.8]]))
logger.info("Result from 'client.async_classify':\n%s", res)
res = await client.async_call("classify", np.array([[5.9, 3, 5.1, 1.8]]))
logger.info("Result from 'client.async_call':\n%s", res)
def run(client: bentoml.client.Client):
res = client.classify(np.array([[5.9, 3, 5.1, 1.8]]))
logger.info("Result from 'client.classify':\n%s", res)
res = client.call("classify", np.array([[5.9, 3, 5.1, 1.8]]))
logger.info("Result from 'client.call(bentoml_api_name='classify')':\n%s", res)
if __name__ == "__main__":
import argparse
logger = logging.getLogger(__name__)
ch = logging.StreamHandler()
formatter = logging.Formatter("%(message)s")
ch.setFormatter(formatter)
logger.addHandler(ch)
logger.setLevel(logging.DEBUG)
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--sync", action="store_true", default=False)
args = parser.parse_args()
c = bentoml.client.Client.from_url("localhost:3000", kind="grpc")
if args.sync:
run(c)
else:
asyncio.run(async_run(c))
Trying to execute the above ☝️ and getting the following exception
root@42ca13f78843:/tmp/bentomlclientexample# python client_grpc_example.py
Traceback (most recent call last):
File "/tmp/bentomlclientexample/client_grpc_example.py", line 46, in <module>
c = bentoml.client.Client.from_url("0.0.0.0:3000", kind="grpc")
File "/usr/local/lib/python3.10/site-packages/bentoml/_internal/client/__init__.py", line 109, in from_url
return SyncClient.from_url(server_url, kind=kind, **kwargs)
File "/usr/local/lib/python3.10/site-packages/bentoml/_internal/client/__init__.py", line 367, in from_url
return SyncGrpcClient.from_url(server_url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/bentoml/_internal/client/grpc.py", line 728, in from_url
with GrpcClient._create_channel(
AttributeError: type object 'GrpcClient' has no attribute '_create_channel'
Neither GrpClient or Client (defined here) have _create_channel defined.
Not that crucial but also worth mentioning that kind="grpc" arg is needed which isn't stated by the doc ☝️ (I had to dig into the code to get it right)
Describe the bug
Using latest
bentoml==1.2.12
versionI'm following the docs on how to use a GRPC client
Trying to execute the above ☝️ and getting the following exception
Looking at the code
Neither
GrpClient
orClient
(defined here) have_create_channel
defined.Not that crucial but also worth mentioning that
kind="grpc"
arg is needed which isn't stated by the doc ☝️ (I had to dig into the code to get it right)To reproduce
No response
Expected behavior
The examples provided in https://docs.bentoml.org/en/v1.1.11/guides/grpc.html should work
Environment
Environment variable
System information
bentoml
: 1.2.12python
: 3.10.9platform
: Linux-5.10.76-linuxkit-aarch64-with-glibc2.31uid_gid
: 0:0pip_packages
The text was updated successfully, but these errors were encountered: