diff options
author | QiLiang <liangqi1@huawei.com> | 2015-10-21 12:29:53 +0000 |
---|---|---|
committer | QiLiang <liangqi1@huawei.com> | 2015-10-27 03:34:28 +0000 |
commit | 2e1094d4aee93180126d3ce86db3cc7df2e87bc5 (patch) | |
tree | 221e98fd325ff6fcb4fbbb3e656a3789f3a77342 /yardstick/benchmark/runners/arithmetic.py | |
parent | 884926d05f435217c7dac038b3bfbd7e9d05826b (diff) |
Heat context code refactor part 2
Heat context code refactor to cater for the evolution of the
Yardstick framework.
Refactor runner_cfg host/target info handle, as specified at
https://etherpad.opnfv.org/p/yardstick_framework
step 4. Get general Context info (use Context.get).
Before this refactor host and target vm must have the same user name
and ssh key, that is not general enough for later extension.
test_case.yaml do NOT need to change.
JIRA: YARDSTICK-168
Change-Id: I5cfe868f3c6f633214ef550bc9676fe1de0709db
Signed-off-by: QiLiang <liangqi1@huawei.com>
Diffstat (limited to 'yardstick/benchmark/runners/arithmetic.py')
-rwxr-xr-x | yardstick/benchmark/runners/arithmetic.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/yardstick/benchmark/runners/arithmetic.py b/yardstick/benchmark/runners/arithmetic.py index 68c8bfdef..af2303479 100755 --- a/yardstick/benchmark/runners/arithmetic.py +++ b/yardstick/benchmark/runners/arithmetic.py @@ -22,7 +22,7 @@ from yardstick.benchmark.runners import base LOG = logging.getLogger(__name__) -def _worker_process(queue, cls, method_name, scenario_cfg): +def _worker_process(queue, cls, method_name, scenario_cfg, context_cfg): sequence = 1 @@ -40,12 +40,13 @@ def _worker_process(queue, cls, method_name, scenario_cfg): LOG.info("worker START, step(%s, %d, %d, %d), class %s", arg_name, start, stop, step, cls) - benchmark = cls(runner_cfg) + benchmark = cls(scenario_cfg, context_cfg) benchmark.setup() method = getattr(benchmark, method_name) queue.put({'runner_id': runner_cfg['runner_id'], - 'scenario_cfg': scenario_cfg}) + 'scenario_cfg': scenario_cfg, + 'context_cfg': context_cfg}) sla_action = None if "sla" in scenario_cfg: @@ -63,7 +64,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg): errors = "" try: - method(scenario_cfg, data) + method(data) except AssertionError as assertion: # SLA validation failed in scenario, determine what to do now if sla_action == "assert": @@ -129,8 +130,8 @@ class ArithmeticRunner(base.Runner): __execution_type__ = 'Arithmetic' - def _run_benchmark(self, cls, method, scenario_cfg): + def _run_benchmark(self, cls, method, scenario_cfg, context_cfg): self.process = multiprocessing.Process( target=_worker_process, - args=(self.result_queue, cls, method, scenario_cfg)) + args=(self.result_queue, cls, method, scenario_cfg, context_cfg)) self.process.start() |