3 # This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
16 import reportingUtils as utils
17 import reportingConf as conf
18 import scenarioResult as sr
21 logger = utils.getLogger("Yardstick-Status")
23 logger.info("*******************************************")
24 logger.info("* Generating reporting scenario status *")
25 logger.info("* Data retention = %s days *" % conf.PERIOD)
27 logger.info("*******************************************")
30 # For all the versions
31 for version in conf.versions:
32 # For all the installers
33 for installer in conf.installers:
34 # get scenarios results data
35 scenario_results = utils.getScenarioStatus(installer, version)
36 if 'colorado' == version:
37 stable_result = utils.getScenarioStatus(installer, 'stable/colorado')
38 for k,v in stable_result.items():
39 if not scenario_results.has_key(k):
40 scenario_results[k] = []
41 scenario_results[k] += stable_result[k]
42 scenario_result_criteria = {}
44 # From each scenarios get results list
45 for s, s_result in scenario_results.items():
46 logger.info("---------------------------------")
47 logger.info("installer %s, version %s, scenario %s:" % (installer, version, s))
49 ten_criteria = len(s_result)
54 four_result = s_result[:conf.LASTEST_TESTS]
55 four_criteria = len(four_result)
60 s_status = str(utils.get_status(four_result, s_result))
61 s_four_score = str(four_score) + '/' + str(four_criteria)
62 s_ten_score = str(ten_score) + '/' + str(ten_criteria)
63 scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_four_score, s_ten_score)
66 logger.info(">>>>> scenario OK, save the information")
68 logger.info(">>>> scenario not OK, last 4 iterations = %s, last 10 days = %s" % (s_four_score, s_ten_score))
69 logger.info("--------------------------")
71 templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)
72 templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True)
74 TEMPLATE_FILE = "/template/index-status-tmpl.html"
75 template = templateEnv.get_template(TEMPLATE_FILE)
77 outputText = template.render(scenario_results=scenario_result_criteria,
82 with open(conf.REPORTING_PATH + "/release/" + version +
83 "/index-status-" + installer + ".html", "wb") as fh: