X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fcmd%2Fcommands%2Ftask.py;h=e2e8bf67d86353cb8d475338bcc86fc75575beaf;hb=31b02e5b95d8b4076ef60667d051a8a1a6b072ba;hp=0f98cabdcd4b61daf8c15dab0474a4dc704af269;hpb=20b220b4907b92b3b1afe659f532f3bb931d0c43;p=yardstick.git diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py index 0f98cabdc..e2e8bf67d 100644 --- a/yardstick/cmd/commands/task.py +++ b/yardstick/cmd/commands/task.py @@ -11,6 +11,8 @@ from __future__ import print_function from __future__ import absolute_import +import logging + from yardstick.benchmark.core.task import Task from yardstick.common.utils import cliargs from yardstick.common.utils import write_json_to_file @@ -19,6 +21,9 @@ from yardstick.cmd.commands import change_osloobj_to_paras output_file_default = "/tmp/yardstick.out" +LOG = logging.getLogger(__name__) + + class TaskCommands(object): # pragma: no cover """Task commands. @@ -45,11 +50,19 @@ class TaskCommands(object): # pragma: no cover param = change_osloobj_to_paras(args) self.output_file = param.output_file + result = {} + LOG.info('Task START') try: - Task().start(param, **kwargs) + result = Task().start(param, **kwargs) except Exception as e: self._write_error_data(e) - raise + LOG.exception("") + + if result.get('result', {}).get('criteria') == 'PASS': + LOG.info('Task SUCCESS') + else: + LOG.info('Task FAILED') + raise RuntimeError('Task Failed') def _write_error_data(self, error): data = {'status': 2, 'result': str(error)}