diff --git a/gnes/client/cli.py b/gnes/client/cli.py index aaf00ed9..2cda73d2 100644 --- a/gnes/client/cli.py +++ b/gnes/client/cli.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() diff --git a/gnes/client/http.py b/gnes/client/http.py index 2cde567f..c41fcedc 100644 --- a/gnes/client/http.py +++ b/gnes/client/http.py @@ -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') @@ -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):