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("*******************************************")
29 # For all the versions
30 for version in conf.versions:
31 # For all the installers
32 for installer in conf.installers:
33 # get scenarios results data
34 scenario_results = utils.getScenarioStatus(installer, version)
35 if 'colorado' == version:
36 stable_result = utils.getScenarioStatus(installer, 'stable/colorado')
37 for k,v in stable_result.items():
38 if not scenario_results.has_key(k):
39 scenario_results[k] = []
40 scenario_results[k] += stable_result[k]
41 for k,v in scenario_results.items():
42 scenario_results[k] = v[0:conf.LASTEST_TESTS]
43 scenario_result_criteria = {}
45 # From each scenarios get results list
46 for s, s_result in scenario_results.items():
47 logger.info("---------------------------------")
48 logger.info("installer %s, version %s, scenario %s:" % (installer, version, s))
51 scenario_criteria = len(s_result)
55 if v['criteria'] == 'SUCCESS':
58 if scenario_score == scenario_criteria and scenario_criteria == 4:
60 logger.info(">>>>> scenario OK, save the information")
62 logger.info(">>>> scenario not OK, score = %s/%s" % (scenario_score, scenario_criteria))
64 s_score = str(scenario_score) + '/' + str(scenario_criteria)
65 scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_score)
67 logger.info("--------------------------")
69 templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)
70 templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True)
72 TEMPLATE_FILE = "/template/index-status-tmpl.html"
73 template = templateEnv.get_template(TEMPLATE_FILE)
75 outputText = template.render(scenario_results=scenario_result_criteria,
80 with open(conf.REPORTING_PATH + "/release/" + version +
81 "/index-status-" + installer + ".html", "wb") as fh: