summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2018-03-29 22:52:42 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-29 22:52:42 +0000
commit0cfb413451484e311ad5d3e956f3bb9c52f6978e (patch)
treebc750f5b9f823e0132a0ab620975c96c2e546881
parent374a6caf766c0503f114a83cc20144f72b10ab45 (diff)
parent4de5b04ab0f337233fb1593829e18216b726d17b (diff)
Merge "task: don't hide exceptions in Task"
-rw-r--r--yardstick/cmd/commands/task.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index a3488a23d..c6379e586 100644
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -25,6 +25,7 @@ class TaskCommands(object): # pragma: no cover
Set of commands to manage benchmark tasks.
"""
+ EXIT_TEST_FAILED = 2
@cliargs("inputfile", type=str, help="path to task or suite file", nargs=1)
@cliargs("--task-args", dest="task_args",
@@ -48,18 +49,20 @@ class TaskCommands(object): # pragma: no cover
param = change_osloobj_to_paras(args)
self.output_file = param.output_file
- result = {}
LOG.info('Task START')
try:
result = Task().start(param, **kwargs)
except Exception as e: # pylint: disable=broad-except
self._write_error_data(e)
-
- if result.get('result', {}).get('criteria') == 'PASS':
- LOG.info('Task SUCCESS')
- else:
LOG.info('Task FAILED')
- raise RuntimeError('Task Failed')
+ raise
+ else:
+ if result.get('result', {}).get('criteria') == 'PASS':
+ LOG.info('Task SUCCESS')
+ else:
+ LOG.info('Task FAILED')
+ # exit without backtrace
+ raise SystemExit(self.EXIT_TEST_FAILED)
def _write_error_data(self, error):
data = {'status': 2, 'result': str(error)}