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 scenario_result_criteria = {}
43 # From each scenarios get results list
44 for s, s_result in scenario_results.items():
45 logger.info("---------------------------------")
46 logger.info("installer %s, version %s, scenario %s:" % (installer, version, s))
49 scenario_criteria = len(s_result)
53 if v['criteria'] == 'SUCCESS':
56 if scenario_score == scenario_criteria and scenario_criteria == 4:
58 logger.info(">>>>> scenario OK, save the information")
60 logger.info(">>>> scenario not OK, score = %s/%s" % (scenario_score, scenario_criteria))
62 s_score = str(scenario_score) + '/' + str(scenario_criteria)
63 scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_score)
65 logger.info("--------------------------")
67 templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)
68 templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True)
70 TEMPLATE_FILE = "/template/index-status-tmpl.html"
71 template = templateEnv.get_template(TEMPLATE_FILE)
73 outputText = template.render(scenario_results=scenario_result_criteria,
78 with open(conf.REPORTING_PATH + "/release/" + version +
79 "/index-status-" + installer + ".html", "wb") as fh: