Skip to content

Commit

Permalink
add gRPC reflection for python wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
CatTail authored and seldondev committed Nov 25, 2020
1 parent e248c2e commit d7f856d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/seldon_core/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import grpc
from grpc_reflection.v1alpha import reflection
import os
import logging
import seldon_core.seldon_methods
Expand All @@ -18,6 +19,7 @@
ANNOTATION_GRPC_MAX_MSG_SIZE,
)
from seldon_core.proto import prediction_pb2_grpc
from seldon_core.proto import prediction_pb2

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -288,4 +290,16 @@ def get_grpc_server(user_model, seldon_metrics, annotations={}, trace_intercepto
prediction_pb2_grpc.add_RouterServicer_to_server(seldon_model, server)
prediction_pb2_grpc.add_SeldonServicer_to_server(seldon_model, server)

SERVICE_NAMES = (
prediction_pb2.DESCRIPTOR.services_by_name["Generic"].full_name,
prediction_pb2.DESCRIPTOR.services_by_name["Model"].full_name,
prediction_pb2.DESCRIPTOR.services_by_name["Router"].full_name,
prediction_pb2.DESCRIPTOR.services_by_name["Transformer"].full_name,
prediction_pb2.DESCRIPTOR.services_by_name["OutputTransformer"].full_name,
prediction_pb2.DESCRIPTOR.services_by_name["Combiner"].full_name,
prediction_pb2.DESCRIPTOR.services_by_name["Seldon"].full_name,
reflection.SERVICE_NAME,
)
reflection.enable_server_reflection(SERVICE_NAMES, server)

return server
1 change: 1 addition & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"opentracing >= 2.2.0, < 2.5.0",
"jaeger-client >= 4.1.0, < 4.4.0",
"grpcio-opentracing >= 1.1.4, < 1.2.0",
"grpcio-reflection==1.29.0",
"PyYAML<5.4",
"gunicorn >= 19.9.0, < 20.1.0",
"setuptools >= 41.0.0",
Expand Down

0 comments on commit d7f856d

Please sign in to comment.