X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Frunners%2Fsequence.py;h=68e272c57269dfc69818ca342fffd8226c52b293;hb=1c69f20b0f681ea66d68d077c7f85466363fee4d;hp=e6abeab3ce354213e7547cd19ff86c8e61536e9a;hpb=4b706011d16f3dfd4fe0a78c5d8706d69deecdeb;p=yardstick.git diff --git a/yardstick/benchmark/runners/sequence.py b/yardstick/benchmark/runners/sequence.py index e6abeab3c..68e272c57 100644 --- a/yardstick/benchmark/runners/sequence.py +++ b/yardstick/benchmark/runners/sequence.py @@ -16,9 +16,9 @@ # 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 @@ -33,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 @@ -57,10 +57,6 @@ def _worker_process(queue, cls, method_name, scenario_cfg, benchmark.setup() method = getattr(benchmark, method_name) - queue.put({'runner_id': runner_cfg['runner_id'], - 'scenario_cfg': scenario_cfg, - 'context_cfg': context_cfg}) - sla_action = None if "sla" in scenario_cfg: sla_action = scenario_cfg["sla"].get("action", "assert") @@ -75,7 +71,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": @@ -86,6 +82,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) @@ -96,10 +95,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg, 'errors': errors } - record = {'runner_id': runner_cfg['runner_id'], - 'benchmark': benchmark_output} - - queue.put(record) + queue.put(benchmark_output) LOG.debug("runner=%(runner)s seq=%(sequence)s END", {"runner": runner_cfg["runner_id"], "sequence": sequence}) @@ -114,7 +110,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 @@ -129,7 +125,7 @@ class SequenceRunner(base.Runner): type: [int] unit: na default: none - ''' + """ __execution_type__ = 'Sequence' @@ -137,5 +133,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()