aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/runners/duration.py
diff options
context:
space:
mode:
authorHans Feldt <hans.feldt@ericsson.com>2015-05-26 11:56:24 +0200
committerHans Feldt <hans.feldt@ericsson.com>2015-05-26 12:14:35 +0200
commitd290591a6f53d74ed00fe49e93654be5c486e998 (patch)
tree7f183c9c33f89b2ffd413236293db8a865e47522 /yardstick/benchmark/runners/duration.py
parentb2d8414cb1ba9700a88d629f6a3d1d88ca9dd92c (diff)
add setup/teardown to scenario base class and runners
Prepare for "service type" of scenarios that e.g. needs to start a service in setup and shut it down in teardown. In the runners, instantiation of the scenario is moved after the "worker START" log to get a more logical sequence logged. Change-Id: Idfaf5bb396eab9261e820291885b5a1dbc32f71e JIRA: - Signed-off-by: Hans Feldt <hans.feldt@ericsson.com>
Diffstat (limited to 'yardstick/benchmark/runners/duration.py')
-rw-r--r--yardstick/benchmark/runners/duration.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/yardstick/benchmark/runners/duration.py b/yardstick/benchmark/runners/duration.py
index 991724826..61d498f02 100644
--- a/yardstick/benchmark/runners/duration.py
+++ b/yardstick/benchmark/runners/duration.py
@@ -25,13 +25,15 @@ def _worker_process(queue, cls, method_name, context, scenario_args):
sequence = 1
- benchmark = cls(context)
- method = getattr(benchmark, method_name)
interval = context.get("interval", 1)
duration = context.get("duration", 60)
+ LOG.info("worker START, duration %d sec, class %s", duration, cls)
+
context['runner'] = os.getpid()
- LOG.info("worker START, duration %d sec, class %s", duration, cls)
+ benchmark = cls(context)
+ benchmark.setup()
+ method = getattr(benchmark, method_name)
record_context = {"runner": context["runner"],
"host": context["host"]}
@@ -81,7 +83,9 @@ def _worker_process(queue, cls, method_name, context, scenario_args):
if (errors and sla_action is None) or (time.time() - start > duration):
LOG.info("worker END")
- return
+ break
+
+ benchmark.teardown()
class DurationRunner(base.Runner):