From 9ee2d15b5f83aae45686b52ef386c7cd9afff428 Mon Sep 17 00:00:00 2001 From: chenjiankum Date: Wed, 12 Oct 2016 16:01:39 +0800 Subject: Add d3 graph presentation to yardstick reporting JIRA: YARDSTICK-367 Change-Id: Ifa2cca1bdfc7d94a84758019d0b1693e09b46e47 Signed-off-by: chenjiankum --- utils/test/reporting/yardstick/reportingUtils.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'utils/test/reporting/yardstick/reportingUtils.py') diff --git a/utils/test/reporting/yardstick/reportingUtils.py b/utils/test/reporting/yardstick/reportingUtils.py index 71eb9196c..ec9ed76dc 100644 --- a/utils/test/reporting/yardstick/reportingUtils.py +++ b/utils/test/reporting/yardstick/reportingUtils.py @@ -32,7 +32,7 @@ def getLogger(module): def getScenarioStatus(installer, version): url = (conf.URL_BASE + "?case=" + "scenario_status" + "&installer=" + installer + - "&version=" + version +"&period=" + str(conf.PERIOD)) + "&version=" + version + "&period=" + str(conf.PERIOD)) request = Request(url) try: @@ -53,7 +53,7 @@ def getScenarioStatus(installer, version): scenario_results[r['scenario']] = [] scenario_results[r['scenario']].append(r) - for k,v in scenario_results.items(): + for k, v in scenario_results.items(): # scenario_results[k] = v[:conf.LASTEST_TESTS] s_list = [] for element in v: @@ -66,20 +66,25 @@ def getScenarioStatus(installer, version): # return scenario_results return result_dict + def subfind(given_list, pattern_list): + for i in range(len(given_list)): - if given_list[i] == pattern_list[0] and given_list[i:i + conf.LASTEST_TESTS] == pattern_list: + if given_list[i] == pattern_list[0] and \ + given_list[i:i + conf.LASTEST_TESTS] == pattern_list: return True return False -def get_percent(status): - + +def _get_percent(status): + if status * 100 % 6: return round(float(status) * 100 / 6, 1) else: return status * 100 / 6 -def get_status(four_list, ten_list): + +def get_percent(four_list, ten_list): four_score = 0 ten_score = 0 @@ -97,13 +102,13 @@ def get_status(four_list, ten_list): else: status = four_score + 1 - return get_percent(status) + return _get_percent(status) def _test(): status = getScenarioStatus("compass", "master") print "status:++++++++++++++++++++++++" - print json.dumps(status,indent=4) + print json.dumps(status, indent=4) if __name__ == '__main__': # pragma: no cover -- cgit 1.2.3-korg