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 scenario_result_criteria = {}
37 # From each scenarios get results list
38 for s, s_result in scenario_results.items():
39 logger.info("---------------------------------")
40 logger.info("installer %s, version %s, scenario %s:" % (installer, version, s))
43 scenario_criteria = len(s_result)
47 if v['details'] == 'SUCCESS':
50 if scenario_score == scenario_criteria:
52 logger.info(">>>>> scenario OK, save the information")
54 logger.info(">>>> scenario not OK, score = %s/%s" % (scenario_score, scenario_criteria))
56 s_score = str(scenario_score) + '/' + str(scenario_criteria)
57 scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_score)
59 logger.info("--------------------------")
61 templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)
62 templateEnv = jinja2.Environment(loader=templateLoader)
64 TEMPLATE_FILE = "/template/index-status-tmpl.html"
65 template = templateEnv.get_template(TEMPLATE_FILE)
67 outputText = template.render(scenario_results=scenario_result_criteria,
72 with open(conf.REPORTING_PATH + "/release/" + version +
73 "/index-status-" + installer + ".html", "wb") as fh: