Skip to content
Permalink
Browse files

fix(client): fix client progress bar, http

  • Loading branch information...
hanxiao committed Aug 27, 2019
1 parent 1ea487f commit 990c879d544b2e0e76c05f33b41d52a85b9a4dc1
Showing with 7 additions and 7 deletions.
  1. +1 −1 gnes/client/cli.py
  2. +6 −6 gnes/client/http.py
@@ -111,7 +111,7 @@ def update(self):
num_bytes / elapsed,
self.num_batch / elapsed,
estleft_str,
(self.total_batch - self.num_batch) / (self.num_batch + 0.0001 / elapsed)
(self.total_batch - self.num_batch) / ((self.num_batch + 0.0001) / elapsed)
))
sys.stdout.flush()

@@ -48,20 +48,20 @@ def start(self):
post_data = await request.post()
if 'query' in post_data.keys():
_file = post_data.get('query')
self.logger.info("query request from input file: %s" % _file.filename)
self.logger.info('query request from input file: %s' % _file.filename)
data['query'] = _file.file.read()
elif 'docs' in post_data.keys():
files = post_data.getall("docs")
self.logger.info("index request from input files: %d files" % len(files))
files = post_data.getall('docs')
self.logger.info('index request from input files: %d files' % len(files))
data['docs'] = [_file.file.read() for _file in files]

self.logger.info('data received, beigin processing')
self.logger.info('data received')
resp = await loop.run_in_executor(
executor,
stub_call,
parser([d for d in data.get('docs')] if hasattr(data, 'docs')
else data.get('query'), *args, **kwargs))
self.logger.info('handling finished, will send to user')
self.logger.info('send back to user')
return web.Response(body=json.dumps({'result': resp, 'meta': None}, ensure_ascii=False),
status=200,
content_type='application/json')
@@ -85,7 +85,7 @@ def start(self):
srv = await loop.create_server(app.make_handler(),
self.args.http_host,
self.args.http_port)
self.logger.info('http server listens to %s:%d ...' % (self.args.http_host, self.args.http_port))
self.logger.info('http server listens at %s:%d' % (self.args.http_host, self.args.http_port))
return srv

def stub_call(req):

0 comments on commit 990c879

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