diff options
author | QiLiang <liangqi1@huawei.com> | 2015-08-10 00:48:17 +0800 |
---|---|---|
committer | QiLiang <liangqi1@huawei.com> | 2015-08-24 11:21:04 +0800 |
commit | 84ab6e07ef9abef13b44b69d41d5886a253751de (patch) | |
tree | 689f18a5f9b661b7244e0ea32d9b2b4d051c64f7 /yardstick/benchmark | |
parent | c4610ed9b6e1f77befae039072d8a5ffdb9af08a (diff) |
Add test result dispatcher
This patch is the initial implementation of DB result storage.
Having implemented a dispathcer which enable user select different ways
to store test results according to different requirements. This patch
can support not only local file storage, but also remote storage by
using http request(it will call common-db-api when available). Later,
local DB sotrage will be supported.
This patch is raw and simple, which is implemented with reference to
openstack ceilometer.
Any comment is welcome.
JIRA: YARDSTICK-61
Change-Id: Icaf8369edfab5d05f0819eb02d5b05dc8a04d69d
Signed-off-by: QiLiang <liangqi1@huawei.com>
Diffstat (limited to 'yardstick/benchmark')
-rw-r--r-- | yardstick/benchmark/runners/base.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/yardstick/benchmark/runners/base.py b/yardstick/benchmark/runners/base.py index 30fa07639..848322679 100644 --- a/yardstick/benchmark/runners/base.py +++ b/yardstick/benchmark/runners/base.py @@ -8,7 +8,6 @@ ############################################################################## import importlib -import json import logging import multiprocessing import subprocess @@ -18,6 +17,7 @@ log = logging.getLogger(__name__) import yardstick.common.utils as utils from yardstick.benchmark.scenarios import base as base_scenario +from yardstick.dispatcher.base import Base as DispatcherBase def _output_serializer_main(filename, queue): @@ -25,16 +25,18 @@ def _output_serializer_main(filename, queue): Use of this process enables multiple instances of a scenario without messing up the output file. ''' - with open(filename, 'a+') as outfile: - while True: - # blocks until data becomes available - record = queue.get() - if record == '_TERMINATE_': - outfile.close() - break - else: - json.dump(record, outfile) - outfile.write('\n') + config = {} + config["type"] = "File" + config["file_path"] = filename + dispatcher = DispatcherBase.get(config) + + while True: + # blocks until data becomes available + record = queue.get() + if record == '_TERMINATE_': + break + else: + dispatcher.record_result_data(record) def _single_action(seconds, command, queue): |