X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Frunners%2Fsequence.py;h=74ff82204fca484b35c1954f5579a5ba4a6f16de;hb=refs%2Fchanges%2F33%2F35333%2F3;hp=3b06e2a362f3007faaf2ba690dfeea74e9b6ab14;hpb=111759372ed1b8433498c53a3cb53e3eff158f50;p=yardstick.git diff --git a/yardstick/benchmark/runners/sequence.py b/yardstick/benchmark/runners/sequence.py index 3b06e2a36..74ff82204 100644 --- a/yardstick/benchmark/runners/sequence.py +++ b/yardstick/benchmark/runners/sequence.py @@ -16,10 +16,11 @@ # yardstick comment: this is a modified copy of # rally/rally/benchmark/runners/constant.py -'''A runner that every run changes a specified input value to the scenario. +"""A runner that every run changes a specified input value to the scenario. The input value in the sequence is specified in a list in the input file. -''' +""" +from __future__ import absolute_import import os import multiprocessing import logging @@ -32,7 +33,7 @@ LOG = logging.getLogger(__name__) def _worker_process(queue, cls, method_name, scenario_cfg, - context_cfg, aborted): + context_cfg, aborted, output_queue): sequence = 1 @@ -74,7 +75,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg, errors = "" try: - method(data) + result = method(data) except AssertionError as assertion: # SLA validation failed in scenario, determine what to do now if sla_action == "assert": @@ -85,6 +86,9 @@ def _worker_process(queue, cls, method_name, scenario_cfg, except Exception as e: errors = traceback.format_exc() LOG.exception(e) + else: + if result: + output_queue.put(result) time.sleep(interval) @@ -113,7 +117,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg, class SequenceRunner(base.Runner): - '''Run a scenario by changing an input value defined in a list + """Run a scenario by changing an input value defined in a list Parameters interval - time to wait between each scenario invocation @@ -128,7 +132,7 @@ class SequenceRunner(base.Runner): type: [int] unit: na default: none - ''' + """ __execution_type__ = 'Sequence' @@ -136,5 +140,5 @@ class SequenceRunner(base.Runner): self.process = multiprocessing.Process( target=_worker_process, args=(self.result_queue, cls, method, scenario_cfg, - context_cfg, self.aborted)) + context_cfg, self.aborted, self.output_queue)) self.process.start()