aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2017-06-19 12:19:41 +0000
committerRoss Brattain <ross.b.brattain@intel.com>2017-07-27 07:57:37 +0000
commit9000303d8df63f8d846b28c67ce1b45f16bb6c8b (patch)
tree43b407727422240a0ee69b2ea93bfe9085d6f66c /yardstick
parentd184d8714e543e4f2497db682154820f7eecf1de (diff)
Adding support for multi-dispatcher
JIRA: YARDSTICK-684 This patch adds the support to enable multi-dispatcher of result. e.g. [DEFAULT] debug = False dispatcher = file, http Change-Id: Id0e1a1bba14edd899fcf5b275be1f0a091b6db77 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/benchmark/core/task.py16
-rw-r--r--yardstick/dispatcher/base.py6
2 files changed, 17 insertions, 5 deletions
diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py
index ede14b1c0..b2da7a2ee 100644
--- a/yardstick/benchmark/core/task.py
+++ b/yardstick/benchmark/core/task.py
@@ -48,6 +48,12 @@ class Task(object): # pragma: no cover
self.contexts = []
self.outputs = {}
+ def _set_dispatchers(self, output_config):
+ dispatchers = output_config.get('DEFAULT', {}).get('dispatcher',
+ 'file')
+ out_types = [s.strip() for s in dispatchers.split(',')]
+ output_config['DEFAULT']['dispatcher'] = out_types
+
def start(self, args, **kwargs):
"""Start a benchmark scenario."""
@@ -68,7 +74,10 @@ class Task(object): # pragma: no cover
self._set_output_config(output_config, args.output_file)
LOG.debug('Output configuration is: %s', output_config)
- if output_config['DEFAULT'].get('dispatcher') == 'file':
+ self._set_dispatchers(output_config)
+
+ # update dispatcher list
+ if 'file' in output_config['DEFAULT']['dispatcher']:
result = {'status': 0, 'result': {}}
utils.write_json_to_file(args.output_file, result)
@@ -198,9 +207,10 @@ class Task(object): # pragma: no cover
return 'PASS'
def _do_output(self, output_config, result):
+ dispatchers = DispatcherBase.get(output_config)
- dispatcher = DispatcherBase.get(output_config)
- dispatcher.flush_result_data(result)
+ for dispatcher in dispatchers:
+ dispatcher.flush_result_data(result)
def _run(self, scenarios, run_in_parallel, output_file):
"""Deploys context and calls runners"""
diff --git a/yardstick/dispatcher/base.py b/yardstick/dispatcher/base.py
index e77249c54..1fc0a2f31 100644
--- a/yardstick/dispatcher/base.py
+++ b/yardstick/dispatcher/base.py
@@ -41,9 +41,11 @@ class Base(object):
def get(config):
"""Returns instance of a dispatcher for dispatcher type.
"""
- out_type = config['DEFAULT']['dispatcher']
+ list_dispatcher = \
+ [Base.get_cls(out_type.capitalize())(config)
+ for out_type in config['DEFAULT']['dispatcher']]
- return Base.get_cls(out_type.capitalize())(config)
+ return list_dispatcher
@abc.abstractmethod
def flush_result_data(self, data):