aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/runners/duration.py
diff options
context:
space:
mode:
authorQiLiang <liangqi1@huawei.com>2015-10-21 12:29:53 +0000
committerQiLiang <liangqi1@huawei.com>2015-10-27 03:34:28 +0000
commit2e1094d4aee93180126d3ce86db3cc7df2e87bc5 (patch)
tree221e98fd325ff6fcb4fbbb3e656a3789f3a77342 /yardstick/benchmark/runners/duration.py
parent884926d05f435217c7dac038b3bfbd7e9d05826b (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/duration.py')
-rw-r--r--yardstick/benchmark/runners/duration.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/yardstick/benchmark/runners/duration.py b/yardstick/benchmark/runners/duration.py
index e4ad037af..40e0aa708 100644
--- a/yardstick/benchmark/runners/duration.py
+++ b/yardstick/benchmark/runners/duration.py
@@ -21,7 +21,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
@@ -33,7 +33,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg):
runner_cfg['runner_id'] = os.getpid()
- benchmark = cls(runner_cfg)
+ benchmark = cls(scenario_cfg, context_cfg)
benchmark.setup()
method = getattr(benchmark, method_name)
@@ -42,7 +42,8 @@ def _worker_process(queue, cls, method_name, scenario_cfg):
sla_action = scenario_cfg["sla"].get("action", "assert")
queue.put({'runner_id': runner_cfg['runner_id'],
- 'scenario_cfg': scenario_cfg})
+ 'scenario_cfg': scenario_cfg,
+ 'context_cfg': context_cfg})
start = time.time()
while True:
@@ -54,7 +55,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":
@@ -109,8 +110,8 @@ If the scenario ends before the time has elapsed, it will be started again.
'''
__execution_type__ = 'Duration'
- 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()