- chart_data = dict()
- chart_tags = dict()
- for job, job_data in data.items():
- if job != job_name:
- continue
- for index, bld in job_data.items():
- for test_name, test in bld.items():
- if chart_data.get(test_name, None) is None:
- chart_data[test_name] = OrderedDict()
- try:
- chart_data[test_name][int(index)] = \
- test[u"result"][u"receive-rate"]
- chart_tags[test_name] = test.get(u"tags", None)
- except (KeyError, TypeError):
- pass
-
- # Add items to the csv table:
- for tst_name, tst_data in chart_data.items():
- tst_lst = list()
- for bld in builds_dict[job_name]:
- itm = tst_data.get(int(bld), u'')
- # CSIT-1180: Itm will be list, compute stats.
- tst_lst.append(str(itm))
- csv_tbl.append(f"{tst_name}," + u",".join(tst_lst) + u'\n')
-
- # Generate traces:
- traces = list()
- index = 0
- groups = graph.get(u"groups", None)
- visibility = list()
-
- if groups:
- for group in groups:
- visible = list()
- for tag in group:
+ return_lst = list()
+
+ for ttype in graph.get(u"test-type", (u"mrr", )):
+ for core in graph.get(u"core", tuple()):
+ csv_tbl = list()
+ csv_tbl_lat_1 = list()
+ csv_tbl_lat_2 = list()
+ res = dict()
+ chart_data = dict()
+ chart_tags = dict()
+ for item in graph.get(u"include", tuple()):
+ reg_ex = re.compile(str(item.format(core=core)).lower())
+ for job, job_data in data.items():
+ if job != job_name:
+ continue
+ for index, bld in job_data.items():
+ for test_id, test in bld.items():
+ if not re.match(reg_ex, str(test_id).lower()):
+ continue
+ if chart_data.get(test_id, None) is None:
+ chart_data[test_id] = OrderedDict()
+ try:
+ lat_1 = u""
+ lat_2 = u""
+ if ttype == u"mrr":
+ rate = test[u"result"][u"receive-rate"]
+ stdev = \
+ test[u"result"][u"receive-stdev"]
+ elif ttype == u"ndr":
+ rate = \
+ test["throughput"][u"NDR"][u"LOWER"]
+ stdev = float(u"nan")
+ elif ttype == u"pdr":
+ rate = \
+ test["throughput"][u"PDR"][u"LOWER"]
+ stdev = float(u"nan")
+ lat_1 = test[u"latency"][u"PDR50"]\
+ [u"direction1"][u"avg"]
+ lat_2 = test[u"latency"][u"PDR50"]\
+ [u"direction2"][u"avg"]
+ else:
+ continue
+ chart_data[test_id][int(index)] = {
+ u"receive-rate": rate,
+ u"receive-stdev": stdev
+ }
+ if ttype == u"pdr":
+ chart_data[test_id][int(index)].update(
+ {
+ u"lat_1": lat_1,
+ u"lat_2": lat_2
+ }
+ )
+ chart_tags[test_id] = \
+ test.get(u"tags", None)
+ except (KeyError, TypeError):
+ pass
+
+ # Add items to the csv table:
+ for tst_name, tst_data in chart_data.items():
+ tst_lst = list()
+ tst_lst_lat_1 = list()
+ tst_lst_lat_2 = list()
+ for bld in builds_dict[job_name]:
+ itm = tst_data.get(int(bld), dict())
+ # CSIT-1180: Itm will be list, compute stats.
+ try:
+ tst_lst.append(str(itm.get(u"receive-rate", u"")))
+ if ttype == u"pdr":
+ tst_lst_lat_1.append(
+ str(itm.get(u"lat_1", u""))
+ )
+ tst_lst_lat_2.append(
+ str(itm.get(u"lat_2", u""))
+ )
+ except AttributeError:
+ tst_lst.append(u"")
+ if ttype == u"pdr":
+ tst_lst_lat_1.append(u"")
+ tst_lst_lat_2.append(u"")
+ csv_tbl.append(f"{tst_name}," + u",".join(tst_lst) + u'\n')
+ csv_tbl_lat_1.append(
+ f"{tst_name}," + u",".join(tst_lst_lat_1) + u"\n"
+ )
+ csv_tbl_lat_2.append(
+ f"{tst_name}," + u",".join(tst_lst_lat_2) + u"\n"
+ )
+
+ # Generate traces:
+ traces = list()
+ traces_lat = list()
+ index = 0
+ groups = graph.get(u"groups", None)
+ visibility = list()
+
+ if groups:
+ for group in groups:
+ visible = list()
+ for tag in group:
+ for tst_name, test_data in chart_data.items():
+ if not test_data:
+ logging.warning(
+ f"No data for the test {tst_name}"
+ )
+ continue
+ if tag not in chart_tags[tst_name]:
+ continue
+ try:
+ trace, rslt = _generate_trending_traces(
+ test_data,
+ job_name=job_name,
+ build_info=build_info,
+ name=u'-'.join(tst_name.split(u'.')[-1].
+ split(u'-')[2:-1]),
+ color=COLORS[index],
+ incl_tests=ttype
+ )
+ except IndexError:
+ logging.error(f"Out of colors: index: "
+ f"{index}, test: {tst_name}")
+ index += 1
+ continue
+ traces.extend(trace)
+ visible.extend(
+ [True for _ in range(len(trace))]
+ )
+ res[tst_name] = rslt
+ index += 1
+ break
+ visibility.append(visible)
+ else: