"""Generation of Continuous Performance Trending and Analysis.
"""
-
import re
import logging
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
else:
hover_str = hover_str.replace(u"<stdev>", u"")
if incl_tests == u"pdr-lat":
- hover_str = hover_str.replace(
- u"throughput [Mpps]", u"latency [s]"
- )
hover_str = hover_str.replace(u"<val>", u"{value:.1e}")
else:
hover_str = hover_str.replace(u"<val>", u"{value:.3f}")
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:
- hover_text.append(hover_str.format(
+ 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",
value=data_y_mpps[index],
test=incl_tests,
period=u"weekly",
build_nr=str_key,
- testbed=build_info[job_name][str_key][2]))
- elif u"vpp" in job_name:
- hover_text.append(hover_str.format(
+ testbed=build_info[job_name][str_key][2])
+ 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,
- testbed=build_info[job_name][str_key][2]))
-
+ testbed=build_info[job_name][str_key][2])
+ if incl_tests == u"pdr-lat":
+ hover_str = hover_str.replace(
+ u"throughput [Mpps]", u"latency [s]"
+ )
+ hover_text.append(hover_str)
xaxis.append(datetime(int(date[0:4]), int(date[4:6]), int(date[6:8]),
int(date[9:11]), int(date[12:])))
# 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')
+ tst = test_name.split(" ")[1].split(".")[1:]
+ nic = tst[0].split("-")[0]
+ tst_name = f"{nic}-{tst[1]}"
+
+ 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"{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')
+ tst = test_name.split(" ")[1].split(".")[1:]
+ nic = tst[0].split("-")[0]
+ tst_name = f"{nic}-{tst[1]}"
+
+ 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"{legend_str}progression in percentage ]")
else:
result = u"FAIL"