提交 d9bb4841 编写于 作者: B barrierye

support endpoints

上级 674167a6
...@@ -16,7 +16,7 @@ import numpy as np ...@@ -16,7 +16,7 @@ import numpy as np
from line_profiler import LineProfiler from line_profiler import LineProfiler
client = PipelineClient() client = PipelineClient()
client.connect('localhost:8080') client.connect(['127.0.0.1:8080'])
lp = LineProfiler() lp = LineProfiler()
lp_wrapper = lp(client.predict) lp_wrapper = lp(client.predict)
......
...@@ -27,8 +27,12 @@ class PipelineClient(object): ...@@ -27,8 +27,12 @@ class PipelineClient(object):
def __init__(self): def __init__(self):
self._channel = None self._channel = None
def connect(self, endpoint): def connect(self, endpoints):
self._channel = grpc.insecure_channel(endpoint) options = [('grpc.max_receive_message_length', 512 * 1024 * 1024),
('grpc.max_send_message_length', 512 * 1024 * 1024),
('grpc.lb_policy_name', 'round_robin')]
g_endpoint = 'ipv4:{}'.format(','.join(endpoints))
self._channel = grpc.insecure_channel(g_endpoint, options=options)
self._stub = pipeline_service_pb2_grpc.PipelineServiceStub( self._stub = pipeline_service_pb2_grpc.PipelineServiceStub(
self._channel) self._channel)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册