summaryrefslogtreecommitdiffstats
path: root/utils/test/reporting/yardstick/reporting-status.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/reporting/yardstick/reporting-status.py')
-rw-r--r--utils/test/reporting/yardstick/reporting-status.py50
1 files changed, 37 insertions, 13 deletions
diff --git a/utils/test/reporting/yardstick/reporting-status.py b/utils/test/reporting/yardstick/reporting-status.py
index 60f1523bb..49809e9d8 100644
--- a/utils/test/reporting/yardstick/reporting-status.py
+++ b/utils/test/reporting/yardstick/reporting-status.py
@@ -8,10 +8,7 @@
#
import datetime
import jinja2
-import requests
-import sys
-import time
-import yaml
+import os
import reportingUtils as utils
import reportingConf as conf
@@ -20,6 +17,7 @@ from scenarios import config as cf
# Logger
logger = utils.getLogger("Yardstick-Status")
+reportingDate = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
logger.info("*******************************************")
logger.info("* Generating reporting scenario status *")
@@ -35,21 +33,23 @@ for version in conf.versions:
# get scenarios results data
scenario_results = utils.getScenarioStatus(installer, version)
if 'colorado' == version:
- stable_result = utils.getScenarioStatus(installer, 'stable/colorado')
- for k,v in stable_result.items():
- if not scenario_results.has_key(k):
+ stable_result = utils.getScenarioStatus(installer,
+ 'stable/colorado')
+ for k, v in stable_result.items():
+ if k not in scenario_results.keys():
scenario_results[k] = []
scenario_results[k] += stable_result[k]
scenario_result_criteria = {}
for s in scenario_results.keys():
- if cf.has_key(installer) and cf[installer].has_key(s):
+ if installer in cf.keys() and s in cf[installer].keys():
scenario_results.pop(s)
# From each scenarios get results list
for s, s_result in scenario_results.items():
logger.info("---------------------------------")
- logger.info("installer %s, version %s, scenario %s:" % (installer, version, s))
+ logger.info("installer %s, version %s, scenario %s:" % (installer,
+ version, s))
ten_criteria = len(s_result)
ten_score = 0
@@ -62,15 +62,38 @@ for version in conf.versions:
for v in four_result:
four_score += v
- s_status = str(utils.get_status(four_result, s_result))
+ s_status = str(utils.get_percent(four_result, s_result))
s_four_score = str(four_score) + '/' + str(four_criteria)
s_ten_score = str(ten_score) + '/' + str(ten_criteria)
- scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_four_score, s_ten_score)
+ s_score_percent = utils.get_percent(four_result, s_result)
if '100' == s_status:
logger.info(">>>>> scenario OK, save the information")
else:
- logger.info(">>>> scenario not OK, last 4 iterations = %s, last 10 days = %s" % (s_four_score, s_ten_score))
+ logger.info(">>>> scenario not OK, last 4 iterations = %s, \
+ last 10 days = %s" % (s_four_score, s_ten_score))
+
+ # Save daily results in a file
+ path_validation_file = (conf.REPORTING_PATH +
+ "/release/" + version +
+ "/scenario_history.txt")
+
+ if not os.path.exists(path_validation_file):
+ with open(path_validation_file, 'w') as f:
+ info = 'date,scenario,installer,details,score\n'
+ f.write(info)
+
+ with open(path_validation_file, "a") as f:
+ info = (reportingDate + "," + s + "," + installer +
+ "," + s_ten_score + "," +
+ str(s_score_percent) + "\n")
+ f.write(info)
+
+ scenario_result_criteria[s] = sr.ScenarioResult(s_status,
+ s_four_score,
+ s_ten_score,
+ s_score_percent)
+
logger.info("--------------------------")
templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)
@@ -82,7 +105,8 @@ for version in conf.versions:
outputText = template.render(scenario_results=scenario_result_criteria,
installer=installer,
period=conf.PERIOD,
- version=version)
+ version=version,
+ date=reportingDate)
with open(conf.REPORTING_PATH + "/release/" + version +
"/index-status-" + installer + ".html", "wb") as fh: