gRPC List API error
See original GitHub issuehi I have a problem when trying to get a list of registerd model from torchserve I’m using both of REST API and gRPC API but only gRPC API don’t work when using ListModelsRequest
in REST API
requests.get("http://0.0.0.0:18091/models")
returns model list successfully
‘models’: [{‘modelName’: ‘aaa’, ‘modelUrl’: ‘aaa.mar’}, {‘modelName’: ‘bbb’, ‘modelUrl’: ‘bbb.mar’}]}
but in gRPC API
def list_models(stub, t):
params = {'next_page_token':int(t)}
try:
response = stub.ListModels(management_pb2.ListModelsRequest(**params))
return response.msg
except grpc.RpcError as e:
logger.error("Failed to gRPC list models.")
logger.info(str(e.details()))
exit(1)
grpc_func.list_models(grpc_func.get_management_stub(), 0)
returns empty list { “nextPageToken”: “0”, “models”: [] }
I’m using exactly same proto file in https://github.com/pytorch/serve/tree/master/frontend/server/src/main/resources/proto
please help
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
GRPC Core: Status codes and their use in gRPC
Code Number Description
OK 0 Not an error; returned on success.
FAILED_PRECONDITION 9
OUT_OF_RANGE 11
Read more >Errors | Cloud APIs - Google Cloud
The following table lists each error code and an example of a good error message. HTTP, gRPC, Example Error Message. 400, INVALID_ARGUMENT, Request...
Read more >Status Response Codes | Google Maps Booking API
Code Status Notes
0 OK Return on Success
3 INVALID_ARGUMENT The client specified an invalid argument.
5 NOT_FOUND Some requested entity wasn't found.
Read more >Handling errors | Yandex Cloud - Documentation
gRPC code gRPC status HTTP code
1 CANCELLED 499
2 UNKNOWN 500
3 INVALID_ARGUMENT 400
Read more >Advanced gRPC Error Usage - Johan Brandhorst
The Go gRPC implementation has a status package which exposes a nice simple interface for creating rich gRPC errors. For example, lets say...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yes , its comments do not match the code , i also try many times
@msaroufim I followed this guide https://github.com/pytorch/serve/blob/master/docs/getting_started.md
I use mac OS and run it using cpu
and changed some codes in torchserve_grpc_client.py to use listmodels
and typed
prints { “nextPageToken”: “0”, “models”: [] } b’{\n “models”: [\n {\n “modelName”: “densenet161”,\n “modelUrl”: “densenet161.mar”\n }\n ]\n}\n’
the result of gRPC above returns empty and result of rest below returns “densenet161” successfully