diff options
author | Deepak S <deepak.s@linux.intel.com> | 2017-06-19 12:19:41 +0000 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-07-27 07:57:37 +0000 |
commit | 9000303d8df63f8d846b28c67ce1b45f16bb6c8b (patch) | |
tree | 43b407727422240a0ee69b2ea93bfe9085d6f66c /yardstick/benchmark/core/task.py | |
parent | d184d8714e543e4f2497db682154820f7eecf1de (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/benchmark/core/task.py')
-rw-r--r-- | yardstick/benchmark/core/task.py | 16 |
1 files changed, 13 insertions, 3 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""" |