diff options
author | chenjiankum <chenjiankun1@huawei.com> | 2016-10-12 16:01:39 +0800 |
---|---|---|
committer | chenjiankum <chenjiankun1@huawei.com> | 2016-10-12 17:28:32 +0800 |
commit | 9ee2d15b5f83aae45686b52ef386c7cd9afff428 (patch) | |
tree | e3ad7ca87725e60a4c63a0b72d4b501f75df6449 /utils/test/reporting/yardstick/reportingUtils.py | |
parent | d9ab655653e2d343a8eac7560c50c6bed632a09f (diff) |
Add d3 graph presentation to yardstick reporting
JIRA: YARDSTICK-367
Change-Id: Ifa2cca1bdfc7d94a84758019d0b1693e09b46e47
Signed-off-by: chenjiankum <chenjiankun1@huawei.com>
Diffstat (limited to 'utils/test/reporting/yardstick/reportingUtils.py')
-rw-r--r-- | utils/test/reporting/yardstick/reportingUtils.py | 21 |
1 files changed, 13 insertions, 8 deletions
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 |