def profile_results(results, installer, profile_fd): result_criterias = {} for s_p, s_p_result in results.iteritems(): avg_last_ten = sum([int(s) for s in s_p_result]) / len(s_p_result) LASTEST_TESTS = rp_utils.get_config( 'general.nb_iteration_tests_success_criteria') last_four = s_p_result[-LASTEST_TESTS:] avg_last_four = sum([int(s) for s in last_four]) / len(last_four) info = '{},{},{},{},{}\n'.format(reportingDate, s_p, installer, '', avg_last_four) profile_fd.write(info) result_criterias[s_p] = sr.ScenarioResult('OK', avg_last_four, avg_last_ten, '100') logger.info("--------------------------") return result_criterias
def profile_results(results, installer, profile_fd): result_criterias = {} for s_p, s_p_result in results.iteritems(): ten_criteria = len(s_p_result) ten_score = sum(s_p_result) LASTEST_TESTS = rp_utils.get_config( 'general.nb_iteration_tests_success_criteria') four_result = s_p_result[:LASTEST_TESTS] four_criteria = len(four_result) four_score = sum(four_result) s_four_score = str(four_score / four_criteria) s_ten_score = str(ten_score / ten_criteria) info = '{},{},{},{},{}\n'.format(reportingDate, s_p, installer, s_ten_score, s_four_score) profile_fd.write(info) result_criterias[s_p] = sr.ScenarioResult('OK', s_four_score, s_ten_score, '100') logger.info("--------------------------") return result_criterias
# Save daily results in a file path_validation_file = ("./display/" + version + "/yardstick/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(".") templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True) TEMPLATE_FILE = "./reporting/yardstick/template/index-status-tmpl.html" template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render(scenario_results=scenario_result_criteria, installer=installer, period=PERIOD, version=version, date=reportingDate)