aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/runners
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-02-25 00:48:07 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-03-08 08:42:32 +0000
commitaf3478e95314b5147c7837831dc8113d552ba067 (patch)
treee9411bebe78eca2f0d204d8a49464e7f620a0ff1 /yardstick/benchmark/runners
parent501175fbb095a771f5f1b9fb80dcf729192214d2 (diff)
Bugfix: yardstick will create stacks with the same name when run using API in parallel
JIRA: YARDSTICK-575 Currently yardstick will create stacks with the same name when run using API in parallel. The reason is there is a global variable in context base and the core will always deploy the first context in Context.list. When run in parallel, it will run in the one process. So yardstick will deploy stacks with the same name. The solution is do not use Context.list in yardstick core. And using a local variable instead. BTW, if we use API to call yardstick core, we can not config the output way. So I parse yardstick.conf when task start. And I think we can include scenario_cfg, context_cfg, yardstick_cfg in one config object later so that we can get all config in one object. Change-Id: I1ada4ef486bd252e78c3a2e49c6a39b3f8f16a7c Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'yardstick/benchmark/runners')
-rwxr-xr-xyardstick/benchmark/runners/base.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/yardstick/benchmark/runners/base.py b/yardstick/benchmark/runners/base.py
index 5b9081523..7c76e42df 100755
--- a/yardstick/benchmark/runners/base.py
+++ b/yardstick/benchmark/runners/base.py
@@ -35,15 +35,18 @@ log = logging.getLogger(__name__)
CONF = cfg.CONF
-def _output_serializer_main(filename, queue):
+def _output_serializer_main(filename, queue, config):
"""entrypoint for the singleton subprocess writing to outfile
Use of this process enables multiple instances of a scenario without
messing up the output file.
"""
- config = {}
- config["type"] = CONF.dispatcher.capitalize()
- config["file_path"] = filename
- dispatcher = DispatcherBase.get(config)
+ out_type = config['yardstick'].get('DEFAULT', {}).get('dispatcher', 'file')
+ conf = {
+ 'type': out_type.capitalize(),
+ 'file_path': filename
+ }
+
+ dispatcher = DispatcherBase.get(conf, config)
while True:
# blocks until data becomes available
@@ -123,21 +126,21 @@ class Runner(object):
return types
@staticmethod
- def get(config):
+ def get(runner_cfg, config):
"""Returns instance of a scenario runner for execution type.
"""
# if there is no runner, start the output serializer subprocess
if not Runner.runners:
log.debug("Starting dump process file '%s'",
- config["output_filename"])
+ runner_cfg["output_filename"])
Runner.queue = multiprocessing.Queue()
Runner.dump_process = multiprocessing.Process(
target=_output_serializer_main,
name="Dumper",
- args=(config["output_filename"], Runner.queue))
+ args=(runner_cfg["output_filename"], Runner.queue, config))
Runner.dump_process.start()
- return Runner.get_cls(config["type"])(config, Runner.queue)
+ return Runner.get_cls(runner_cfg["type"])(runner_cfg, Runner.queue)
@staticmethod
def release_dump_process():