+ test_type = u""
+
+ for ttype in plot.get(u"test-type", (u"ndr", u"pdr")):
+ for core in plot.get(u"core", tuple()):
+ # Prepare the data for the plot
+ data_x = list()
+ data_y = OrderedDict()
+ data_y_max = list()
+ idx = 1
+ for item in plot.get(u"include", tuple()):
+ reg_ex = re.compile(str(item.format(core=core)).lower())
+ for job in data:
+ for build in job:
+ for test_id, test in build.iteritems():
+ if not re.match(reg_ex, str(test_id).lower()):
+ continue
+ if data_y.get(test[u"parent"], None) is None:
+ data_y[test[u"parent"]] = list()
+ test_type = test[u"type"]
+ data_x.append(idx)
+ idx += 1
+ try:
+ data_y[test[u"parent"]].append(
+ test[value][ttype.upper()][u"LOWER"] *
+ multiplier
+ )
+ except (KeyError, TypeError):
+ pass
+
+ # Add plot traces
+ traces = list()
+ for idx, (key, vals) in enumerate(data_y.items()):
+ name = re.sub(
+ REGEX_NIC, u'', key.lower().replace(u'-ndrpdr', u'').
+ replace(u'2n1l-', u'')
+ )
+ kwargs = dict(
+ y=[y / 1e6 if y else None for y in vals],
+ name=(
+ f"{idx + 1}."
+ f"({len(vals):02d} "
+ f"run"
+ f"{u's' if len(vals) > 1 else u''}) "
+ f"{name}"
+ ),
+ hoverinfo=u"y+name"
+ )
+ box_points = plot.get(u"boxpoints", u"all")
+ if box_points in \
+ (u"all", u"outliers", u"suspectedoutliers", False):
+ kwargs[u"boxpoints"] = box_points
+ kwargs[u"jitter"] = 0.3
+ traces.append(plgo.Box(**kwargs))
+ try:
+ data_y_max.append(max(vals))
+ except ValueError as err:
+ logging.warning(f"No values to use.\n{err!r}")
+ try:
+ # Create plot
+ layout = deepcopy(plot[u"layout"])
+ layout[u"xaxis"][u"tickvals"] = [i for i in range(len(data_y))]
+ layout[u"xaxis"][u"ticktext"] = \
+ [str(i + 1) for i in range(len(data_y))]
+ if layout.get(u"title", None):
+ layout[u"title"] = \
+ layout[u'title'].format(core=core, test_type=ttype)
+ if test_type in (u"CPS", ):
+ layout[u"title"] = f"<b>CPS:</b> {layout[u'title']}"
+ else:
+ layout[u"title"] = \
+ f"<b>Tput:</b> {layout[u'title']}"
+ if data_y_max:
+ layout[u"yaxis"][u"range"] = [0, max(data_y_max) / 1e6 + 1]
+ plpl = plgo.Figure(data=traces, layout=layout)
+
+ # Export Plot
+ file_name = (
+ f"{plot[u'output-file'].format(core=core, test_type=ttype)}"
+ f".html"
+ )
+ logging.info(f" Writing file {file_name}")
+ ploff.plot(
+ plpl,
+ show_link=False,
+ auto_open=False,
+ filename=file_name
+ )
+ except PlotlyError as err:
+ logging.error(
+ f" Finished with error: {repr(err)}".replace(u"\n", u" ")
+ )
+
+
+def plot_mrr_box_name(plot, input_data):
+ """Generate the plot(s) with algorithm: plot_mrr_box_name
+ specified in the specification file.
+
+ :param plot: Plot to generate.
+ :param input_data: Data to process.
+ :type plot: pandas.Series
+ :type input_data: InputData
+ """
+
+ # Transform the data
+ logging.info(
+ f" Creating data set for the {plot.get(u'type', u'')} "
+ f"{plot.get(u'title', u'')}."
+ )
+ data = input_data.filter_tests_by_name(
+ plot,
+ params=[u"result", u"parent", u"tags", u"type"]
+ )
+ if data is None:
+ logging.error(u"No data.")
+ return
+
+ for core in plot.get(u"core", tuple()):
+ # Prepare the data for the plot
+ data_x = list()
+ data_names = list()
+ data_y = list()
+ data_y_max = list()
+ idx = 1
+ for item in plot.get(u"include", tuple()):
+ reg_ex = re.compile(str(item.format(core=core)).lower())
+ for job in data:
+ for build in job:
+ for test_id, test in build.iteritems():
+ if not re.match(reg_ex, str(test_id).lower()):
+ continue
+ try:
+ data_x.append(idx)
+ name = re.sub(
+ REGEX_NIC, u'', test[u'parent'].lower().
+ replace(u'-mrr', u'').replace(u'2n1l-', u'')
+ )
+ data_y.append(test[u"result"][u"samples"])
+ data_names.append(
+ f"{idx}."
+ f"({len(data_y[-1]):02d} "
+ f"run{u's' if len(data_y[-1]) > 1 else u''}) "
+ f"{name}"
+ )
+ data_y_max.append(max(data_y[-1]))
+ idx += 1
+ except (KeyError, TypeError):
+ pass
+
+ # Add plot traces
+ traces = list()
+ for idx, x_item in enumerate(data_x):
+ kwargs = dict(
+ y=data_y[idx],