diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-12-14 17:07:59 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-12-14 17:09:32 +0800 |
commit | f18a9a8f3d3b3908348604930f543953e4c5f341 (patch) | |
tree | 5ac910d305e1f54d349d25278d0970abad6227a7 | |
parent | 7151a563bb0bf189a0070d585942d8787cd449a6 (diff) |
make qtip-server installable
JIRA: QTIP-189
Change-Id: I8de0fa1ff3033fd37c499e75f35a5387f5345f8f
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
-rw-r--r-- | qtip/api/handler/result_handler.py | 40 | ||||
-rw-r--r-- | setup.cfg | 1 |
2 files changed, 39 insertions, 2 deletions
diff --git a/qtip/api/handler/result_handler.py b/qtip/api/handler/result_handler.py index de91cd2c..3d1d592e 100644 --- a/qtip/api/handler/result_handler.py +++ b/qtip/api/handler/result_handler.py @@ -6,13 +6,49 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +import importlib import json -import scripts.ref_results.suite_result as suite_result +from os.path import expanduser + import qtip.utils.dashboard.pushtoDB as push_to_db +from qtip.utils import logger_utils + +logger = logger_utils.QtipLogger('suite_result').get + + +def get_benchmark_result(benchmark_name, suite_name): + benchmark_indices = importlib.import_module('scripts.ref_results' + '.{0}_benchmarks_indices'.format(suite_name)) + methodToCall = getattr(benchmark_indices, '{0}_index'.format(benchmark_name)) + return methodToCall() def dump_suite_result(suite_name): - return suite_result.get_suite_result(suite_name) + suite_dict = {} + suite_bench_list = {'compute': ['DPI', 'Dhrystone', 'Whetstone', 'SSL', 'RamSpeed'], + 'storage': ['FIO'], + 'network': ['IPERF']} + temp = 0 + l = len(suite_bench_list[suite_name]) + for benchmark in suite_bench_list[suite_name]: + try: + suite_dict[benchmark] = get_benchmark_result(benchmark.lower(), suite_name) + temp = temp + float(suite_dict[benchmark]['index']) + except OSError: + l = l - 1 + pass + + if l == 0: + logger.info("No {0} suite results found".format(suite_name)) + return False + else: + suite_index = temp / l + suite_dict_f = {'index': suite_index, + 'suite_results': suite_dict} + result_path = expanduser('~') + '/qtip/results' + with open('{0}/{1}_result.json'.format(result_path, suite_name), 'w+') as result_json: + json.dump(suite_dict_f, result_json, indent=4, sort_keys=True) + return True def push_suite_result_to_db(suite_name, test_db_url, installer_type, node_name): @@ -14,6 +14,7 @@ setup-hooks = [entry_points] console_scripts = qtip = qtip.cli.entry:cli + qtip-server = qtip.api.cmd.server:main [files] packages = |