X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_cpta.py;h=923d56bf4252d3cd7941099f8071280c1f0085e2;hb=refs%2Fchanges%2F29%2F34729%2F2;hp=5cc56fd9655d994dd95f4154808a5bd2e9388477;hpb=3b5495d0943283e96ce5fa23c0b1f31846ca0f6f;p=csit.git diff --git a/resources/tools/presentation/generator_cpta.py b/resources/tools/presentation/generator_cpta.py index 5cc56fd965..923d56bf42 100644 --- a/resources/tools/presentation/generator_cpta.py +++ b/resources/tools/presentation/generator_cpta.py @@ -13,7 +13,6 @@ """Generation of Continuous Performance Trending and Analysis. """ - import re import logging import csv @@ -21,6 +20,7 @@ import csv from collections import OrderedDict from datetime import datetime from copy import deepcopy +from os import listdir import prettytable import plotly.offline as ploff @@ -223,7 +223,18 @@ def _generate_trending_traces(in_data, job_name, build_info, if u"-cps" in name: hover_str = hover_str.replace(u"[Mpps]", u"[Mcps]").\ replace(u"throughput", u"connection rate") - if u"dpdk" in job_name: + if u"vpp" in job_name: + hover_str = hover_str.format( + date=date, + property=u"average" if incl_tests == u"mrr" else u"throughput", + value=data_y_mpps[index], + sut=u"vpp", + build=build_info[job_name][str_key][1].rsplit(u'~', 1)[0], + test=incl_tests, + period=u"daily" if incl_tests == u"mrr" else u"weekly", + build_nr=str_key, + testbed=build_info[job_name][str_key][2]) + elif u"dpdk" in job_name: hover_str = hover_str.format( date=date, property=u"average" if incl_tests == u"mrr" else u"throughput", @@ -234,13 +245,13 @@ def _generate_trending_traces(in_data, job_name, build_info, period=u"weekly", build_nr=str_key, testbed=build_info[job_name][str_key][2]) - elif u"vpp" in job_name: + elif u"trex" in job_name: hover_str = hover_str.format( date=date, property=u"average" if incl_tests == u"mrr" else u"throughput", value=data_y_mpps[index], - sut=u"vpp", - build=build_info[job_name][str_key][1].rsplit(u'~', 1)[0], + sut=u"trex", + build=u"", test=incl_tests, period=u"daily" if incl_tests == u"mrr" else u"weekly", build_nr=str_key, @@ -827,22 +838,74 @@ def _generate_all_charts(spec, input_data): # Evaluate result: if anomaly_classifications: + legend_str = (f"Legend:\n[ Last trend in Mpps/Mcps | number of runs for" + f" last trend | ") result = u"PASS" for job_name, job_data in anomaly_classifications.items(): + data = [] + tb = u"-".join(job_name.split(u"-")[-2:]) + for file in listdir(f"{spec.cpta[u'output-file']}"): + if tb in file and u"performance-trending-dashboard" in \ + file and u"txt" in file: + file_to_read = f"{spec.cpta[u'output-file']}/{file}" + with open(f"{file_to_read}", u"rt") as input: + data = data + input.readlines() file_name = \ f"{spec.cpta[u'output-file']}/regressions-{job_name}.txt" with open(file_name, u'w') as txt_file: for test_name, classification in job_data.items(): if classification == u"regression": - txt_file.write(test_name + u'\n') + if u"2n" in test_name: + test_name = test_name.split("-", 2) + tst = test_name[2].split(".")[-1] + nic = test_name[1] + tst_name = f"{nic}-{tst}" + else: + test_name = test_name.split("-", 1) + tst = test_name[1].split(".")[-1] + nic = test_name[0].split(".")[-1] + tst_name = f"{nic}-{tst}" + + for line in data: + if tst_name in line: + line = line.replace(" ", "") + trend = line.split("|")[2] + number = line.split("|")[3] + ltc = line.split("|")[4] + txt_file.write(f"{tst_name} [ {trend}M | " + f"#{number} | {ltc}% ]\n") + if classification in (u"regression", u"outlier"): result = u"FAIL" + + txt_file.write(f"\n{legend_str}regression in percentage ]") + file_name = \ f"{spec.cpta[u'output-file']}/progressions-{job_name}.txt" with open(file_name, u'w') as txt_file: for test_name, classification in job_data.items(): if classification == u"progression": - txt_file.write(test_name + u'\n') + if u"2n" in test_name: + test_name = test_name.split("-", 2) + tst = test_name[2].split(".")[-1] + nic = test_name[1] + tst_name = f"{nic}-{tst}" + else: + test_name = test_name.split("-", 1) + tst = test_name[1].split(".")[-1] + nic = test_name[0].split(".")[-1] + tst_name = f"{nic}-{tst}" + + for line in data: + if tst_name in line: + line = line.replace(" ", "") + trend = line.split("|")[2] + number = line.split("|")[3] + ltc = line.split("|")[4] + txt_file.write(f"{tst_name} [ {trend}M | " + f"#{number} | {ltc}% ]\n") + + txt_file.write(f"\n{legend_str}progression in percentage ]") else: result = u"FAIL"