Skip to content
Permalink
Browse files

fix(parser): remove limite on message size

  • Loading branch information...
hanxiao committed Sep 12, 2019
1 parent cc72cf2 commit 00c25f3981b214910d9a0c38fb6be3b64995960c
Showing with 20 additions and 14 deletions.
  1. +2 −2 gnes/cli/parser.py
  2. +2 −2 gnes/client/benchmark.py
  3. +8 −3 gnes/client/http.py
  4. +2 −2 gnes/service/frontend.py
  5. +2 −2 gnes/service/grpc.py
  6. +4 −3 setup.py
@@ -240,8 +240,8 @@ def _set_grpc_parser(parser=None):
type=int,
default=8800,
help='host port of the grpc service')
parser.add_argument('--max_message_size', type=int, default=100,
help='maximum send and receive size for grpc server in (MB)')
parser.add_argument('--max_message_size', type=int, default=-1,
help='maximum send and receive size for grpc server in bytes, -1 means unlimited')
return parser


@@ -27,8 +27,8 @@ def __init__(self, args):

with grpc.insecure_channel(
'%s:%d' % (args.grpc_host, args.grpc_port),
options=[('grpc.max_send_message_length', args.max_message_size * 1024 * 1024),
('grpc.max_receive_message_length', args.max_message_size * 1024 * 1024)]) as channel:
options=[('grpc.max_send_message_length', args.max_message_size),
('grpc.max_receive_message_length', args.max_message_size)]) as channel:
stub = gnes_pb2_grpc.GnesRPCStub(channel)

id = 0
@@ -31,7 +31,12 @@ def __init__(self, args=None):
self.logger = set_logger(self.__class__.__name__, self.args.verbose)

def start(self):
from aiohttp import web
try:
from aiohttp import web
except ImportError:
self.logger.error('can not import aiohttp, it is not installed correctly. please do '
'"pip install gnes[aiohttp]"')
return
loop = asyncio.get_event_loop()
executor = ThreadPoolExecutor(max_workers=self.args.max_workers)

@@ -94,8 +99,8 @@ def stub_call(req):

with grpc.insecure_channel(
'%s:%s' % (self.args.grpc_host, self.args.grpc_port),
options=[('grpc.max_send_message_length', self.args.max_message_size * 1024 * 1024),
('grpc.max_receive_message_length', self.args.max_message_size * 1024 * 1024),
options=[('grpc.max_send_message_length', self.args.max_message_size),
('grpc.max_receive_message_length', self.args.max_message_size),
('grpc.keepalive_timeout_ms', 100 * 1000)]) as channel:
stub = gnes_pb2_grpc.GnesRPCStub(channel)
loop.run_until_complete(init(loop))
@@ -31,8 +31,8 @@ def __init__(self, args):
self.logger = set_logger(self.__class__.__name__, args.verbose)
self.server = grpc.server(
ThreadPoolExecutor(max_workers=args.max_concurrency),
options=[('grpc.max_send_message_length', args.max_message_size * 1024 * 1024),
('grpc.max_receive_message_length', args.max_message_size * 1024 * 1024)])
options=[('grpc.max_send_message_length', args.max_message_size),
('grpc.max_receive_message_length', args.max_message_size)])
self.logger.info('start a frontend with %d workers' % args.max_concurrency)
gnes_pb2_grpc.add_GnesRPCServicer_to_server(self._Servicer(args), self.server)

@@ -27,8 +27,8 @@ class GRPCService(BS):
def post_init(self):
self.channel = grpc.insecure_channel(
'%s:%s' % (self.args.grpc_host, self.args.grpc_port),
options=[('grpc.max_send_message_length', self.args.max_message_size * 1024 * 1024),
('grpc.max_receive_message_length', self.args.max_message_size * 1024 * 1024)])
options=[('grpc.max_send_message_length', self.args.max_message_size),
('grpc.max_receive_message_length', self.args.max_message_size)])

m = PathImporter.add_modules(self.args.pb2_path, self.args.pb2_grpc_path)

@@ -52,8 +52,7 @@
'protobuf',
'grpcio',
'ruamel.yaml>=0.15.89',
'pyzmq>=17.1.0',
'aiohttp']
'pyzmq>=17.1.0']

# using pip install gnes[xx] is depreciated
# extras_dep is kept for legacy issue, will be removed soon
@@ -73,7 +72,9 @@
'onnx': ['onnxruntime'],
'audio': ['librosa>=0.7.0'],
'scipy': ['scipy', 'sklearn'],
'flask': ['flask']
'flask': ['flask'],
'aiohttp': ['aiohttp'],
'http': ['flask', 'aiohttp']
}


0 comments on commit 00c25f3

Please sign in to comment.
You can’t perform that action at this time.