aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2018-03-24 17:09:36 -0700
committerahothan <ahothan@cisco.com>2018-03-24 17:11:25 -0700
commit42b8c6bee8e2f64c53b86ceba76210645b10da69 (patch)
tree79fedafbc7dd27ee9829ba3015ce7bd52da46ec0
parentad043dbc66865d79d78e5d0954c4b2eea32edecd (diff)
[NFVBENCH-76] REST API remains in running state in case of exception
catch the exception if result key is missing Change-Id: Id212497bb760b835b542afd11ffbe149bc3d46e7 Signed-off-by: ahothan <ahothan@cisco.com>
-rw-r--r--nfvbench/nfvbenchd.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/nfvbench/nfvbenchd.py b/nfvbench/nfvbenchd.py
index 76906c5..fa781af 100644
--- a/nfvbench/nfvbenchd.py
+++ b/nfvbench/nfvbenchd.py
@@ -226,7 +226,7 @@ class WebSocketIoServer(object):
# print 'main thread waiting for requests...'
config = Ctx.dequeue()
# print 'main thread processing request...'
- print config
+ # print config
try:
# remove unfilled values as we do not want them to override default values with None
config = {k: v for k, v in config.items() if v is not None}
@@ -243,8 +243,15 @@ class WebSocketIoServer(object):
else:
# this might overwrite a previously unfetched result
Ctx.set_result(results)
- summary = NFVBenchSummarizer(results['result'], self.fluent_logger)
- LOG.info(str(summary))
+ try:
+ summary = NFVBenchSummarizer(results['result'], self.fluent_logger)
+ LOG.info(str(summary))
+ except KeyError:
+ # in case of error, 'result' might be missing
+ if 'error_message' in results:
+ LOG.error(results['error_message'])
+ else:
+ LOG.error('REST request completed without results or error message')
Ctx.release()
if self.fluent_logger:
self.fluent_logger.send_run_summary(True)