Commit be064a91 authored by Daniele Venzano's avatar Daniele Venzano

Handle errors streaming log files

parent d9e9325d
...@@ -72,16 +72,19 @@ class WebSocketEndpointWeb(ZoeWSRequestHandler): ...@@ -72,16 +72,19 @@ class WebSocketEndpointWeb(ZoeWSRequestHandler):
response['endpoints'] = endpoints response['endpoints'] = endpoints
self.write_message(response) self.write_message(response)
elif request['command'] == 'service_logs': elif request['command'] == 'service_logs':
log_obj = self.api_endpoint.service_logs(self.current_user, request['service_id']) try:
log_obj = self.api_endpoint.service_logs(self.current_user, request['service_id'])
while not self.connection_closed: except zoe_api.exceptions.ZoeException as e:
try: self.write_message(str(e))
log_line = yield THREAD_POOL.submit(next, log_obj) else:
except StopIteration: while not self.connection_closed:
yield tornado.gen.sleep(0.2) try:
continue log_line = yield THREAD_POOL.submit(next, log_obj)
except StopIteration:
self.write_message(log_line) yield tornado.gen.sleep(0.2)
continue
self.write_message(log_line)
elif request['command'] == 'system_status': elif request['command'] == 'system_status':
stats = self.api_endpoint.statistics_scheduler() stats = self.api_endpoint.statistics_scheduler()
self.write_message(json.dumps(stats)) self.write_message(json.dumps(stats))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment