X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_CPTA.py;h=eec401bd1f53ee46b9b91c151d3700ca1c5cb7d7;hb=refs%2Fchanges%2F37%2F23737%2F4;hp=9780d3548862dda10c32ed0202722fca05f2d9c4;hpb=8ac5ba53849699185092d0480cdac0cfaff5e618;p=csit.git diff --git a/resources/tools/presentation/generator_CPTA.py b/resources/tools/presentation/generator_CPTA.py index 9780d35488..eec401bd1f 100644 --- a/resources/tools/presentation/generator_CPTA.py +++ b/resources/tools/presentation/generator_CPTA.py @@ -181,7 +181,7 @@ def _generate_trending_traces(in_data, job_name, build_info, if "dpdk" in job_name: hover_text.append(hover_str.format( date=date, - value=int(in_data[idx].avg), + value=int(in_data[idx]), sut="dpdk", build=build_info[job_name][str(idx)][1].rsplit('~', 1)[0], period="weekly", @@ -190,7 +190,7 @@ def _generate_trending_traces(in_data, job_name, build_info, elif "vpp" in job_name: hover_text.append(hover_str.format( date=date, - value=int(in_data[idx].avg), + value=int(in_data[idx]), sut="vpp", build=build_info[job_name][str(idx)][1].rsplit('~', 1)[0], period="daily", @@ -228,7 +228,7 @@ def _generate_trending_traces(in_data, job_name, build_info, trace_samples = plgo.Scatter( x=xaxis, - y=[y.avg for y in data_y], + y=[y for y in data_y], # Was: y.avg mode='markers', line={ "width": 1 @@ -333,7 +333,7 @@ def _generate_all_charts(spec, input_data): job_name = graph["data"].keys()[0] csv_tbl = list() - res = list() + res = dict() # Transform the data logs.append(("INFO", " Creating the data set for the {0} '{1}'.". @@ -364,8 +364,7 @@ def _generate_all_charts(spec, input_data): tst_lst = list() for bld in builds_dict[job_name]: itm = tst_data.get(int(bld), '') - if not isinstance(itm, str): - itm = itm.avg + # CSIT-1180: Itm will be list, compute stats. tst_lst.append(str(itm)) csv_tbl.append("{0},".format(tst_name) + ",".join(tst_lst) + '\n') @@ -379,22 +378,22 @@ def _generate_all_charts(spec, input_data): for group in groups: visible = list() for tag in group: - for test_name, test_data in chart_data.items(): + for tst_name, test_data in chart_data.items(): if not test_data: logs.append(("WARNING", "No data for the test '{0}'". - format(test_name))) + format(tst_name))) continue - if tag in chart_tags[test_name]: + if tag in chart_tags[tst_name]: message = "index: {index}, test: {test}".format( - index=index, test=test_name) - test_name = test_name.split('.')[-1] + index=index, test=tst_name) try: trace, rslt = _generate_trending_traces( test_data, job_name=job_name, build_info=build_info, - name='-'.join(test_name.split('-')[2:-1]), + name='-'.join(tst_name.split('.')[-1]. + split('-')[2:-1]), color=COLORS[index]) except IndexError: message = "Out of colors: {}".format(message) @@ -404,25 +403,24 @@ def _generate_all_charts(spec, input_data): continue traces.extend(trace) visible.extend([True for _ in range(len(trace))]) - res.append(rslt) + res[tst_name] = rslt index += 1 break visibility.append(visible) else: - for test_name, test_data in chart_data.items(): + for tst_name, test_data in chart_data.items(): if not test_data: logs.append(("WARNING", "No data for the test '{0}'". - format(test_name))) + format(tst_name))) continue message = "index: {index}, test: {test}".format( - index=index, test=test_name) - test_name = test_name.split('.')[-1] + index=index, test=tst_name) try: trace, rslt = _generate_trending_traces( test_data, job_name=job_name, build_info=build_info, - name='-'.join(test_name.split('-')[2:-1]), + name='-'.join(tst_name.split('.')[-1].split('-')[2:-1]), color=COLORS[index]) except IndexError: message = "Out of colors: {}".format(message) @@ -431,7 +429,7 @@ def _generate_all_charts(spec, input_data): index += 1 continue traces.extend(trace) - res.append(rslt) + res[tst_name] = rslt index += 1 if traces: @@ -535,7 +533,7 @@ def _generate_all_charts(spec, input_data): testbed ) - anomaly_classifications = list() + anomaly_classifications = dict() # Create the header: csv_tables = dict() @@ -554,9 +552,12 @@ def _generate_all_charts(spec, input_data): for chart in spec.cpta["plots"]: result = _generate_chart(chart) - anomaly_classifications.extend(result["results"]) csv_tables[result["job_name"]].extend(result["csv_table"]) + if anomaly_classifications.get(result["job_name"], None) is None: + anomaly_classifications[result["job_name"]] = dict() + anomaly_classifications[result["job_name"]].update(result["results"]) + # Write the tables: for job_name, csv_table in csv_tables.items(): file_name = spec.cpta["output-file"] + "-" + job_name + "-trending" @@ -590,10 +591,22 @@ def _generate_all_charts(spec, input_data): # Evaluate result: if anomaly_classifications: result = "PASS" - for classification in anomaly_classifications: - if classification == "regression" or classification == "outlier": - result = "FAIL" - break + for job_name, job_data in anomaly_classifications.iteritems(): + file_name = "{0}-regressions-{1}.txt".\ + format(spec.cpta["output-file"], job_name) + with open(file_name, 'w') as txt_file: + for test_name, classification in job_data.iteritems(): + if classification == "regression": + txt_file.write(test_name + '\n') + if classification == "regression" or \ + classification == "outlier": + result = "FAIL" + file_name = "{0}-progressions-{1}.txt".\ + format(spec.cpta["output-file"], job_name) + with open(file_name, 'w') as txt_file: + for test_name, classification in job_data.iteritems(): + if classification == "progression": + txt_file.write(test_name + '\n') else: result = "FAIL"