Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(client): fix client progress bar, http
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 27, 2019
1 parent 1ea487f commit 990c879
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gnes/client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
12 changes: 6 additions & 6 deletions gnes/client/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ async def general_handler(request, parser, *args, **kwargs):
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')
Expand All @@ -85,7 +85,7 @@ async def init(loop):
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):
Expand Down

0 comments on commit 990c879

Please sign in to comment.