Report: Add boxpoints to aws tput graphs
[csit.git] / resources / tools / presentation / generator_plots.py
index f273aeb..6006ae9 100644 (file)
@@ -145,24 +145,32 @@ def plot_statistics(plot, input_data):
                 d_y_fail = meta[u"tests_failed"]
                 minutes = meta[u"elapsedtime"] // 60000
                 duration = f"{(minutes // 60):02d}:{(minutes % 60):02d}"
-                version = meta[u"version"]
+                version = meta.get(u"version", u"")
             except (KeyError, IndexError, ValueError, AttributeError):
                 continue
             data_x.append(date)
             data_y_pass.append(d_y_pass)
             data_y_fail.append(d_y_fail)
             data_y_duration.append(minutes)
+            if u"vpp" in job:
+                sut = u"vpp"
+            elif u"dpdk" in job:
+                sut = u"dpdk"
+            elif u"trex" in job:
+                sut = u"trex"
+            else:
+                sut = u""
             hover_text.append(hover_str.format(
                 date=date,
                 passed=d_y_pass,
                 failed=d_y_fail,
                 duration=duration,
-                sut=u"vpp" if u"vpp" in job else u"dpdk",
+                sut=sut,
                 build=version,
                 test=u"mrr" if u"mrr" in job else u"ndrpdr",
                 period=u"daily" if u"daily" in job else u"weekly",
                 build_nr=build_nr,
-                testbed=meta[u"testbed"]
+                testbed=meta.get(u"testbed", u"")
             ))
 
     traces = [
@@ -193,9 +201,9 @@ def plot_statistics(plot, input_data):
 
     logging.info(f"    Writing the file {name_file}")
     plpl = plgo.Figure(data=traces, layout=plot[u"layout"])
-    tickvals = [min(data_y_duration), max(data_y_duration)]
-    step = (tickvals[1] - tickvals[0]) / 6
-    for i in range(6):
+    tickvals = [0, (max(data_y_duration) // 60) * 60]
+    step = tickvals[1] / 5
+    for i in range(5):
         tickvals.append(int(tickvals[0] + step * (i + 1)))
     plpl.update_layout(
         yaxis2=dict(
@@ -203,6 +211,7 @@ def plot_statistics(plot, input_data):
             anchor=u"x",
             overlaying=u"y",
             side=u"right",
+            rangemode="tozero",
             tickmode=u"array",
             tickvals=tickvals,
             ticktext=[f"{(val // 60):02d}:{(val % 60):02d}" for val in tickvals]
@@ -890,20 +899,23 @@ def plot_ndrpdr_box_name(plot, input_data):
                     REGEX_NIC, u'', key.lower().replace(u'-ndrpdr', u'').
                     replace(u'2n1l-', u'')
                 )
-                traces.append(
-                    plgo.Box(
-                        x=[data_x[idx], ] * len(data_x),
-                        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"
-                    )
+                kwargs = dict(
+                    x=[data_x[idx], ] * len(data_x),
+                    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", None)
+                if box_points and box_points in \
+                        (u"all", u"outliers", u"suspectedoutliers", False):
+                    kwargs[u"boxpoints"] = box_points
+                traces.append(plgo.Box(**kwargs))
                 try:
                     data_y_max.append(max(vals))
                 except ValueError as err:
@@ -1513,8 +1525,6 @@ def plot_nf_heatmap(plot, input_data):
     regex_test_name = re.compile(r'^.*-(\d+ch|\d+pl)-'
                                  r'(\d+mif|\d+vh)-'
                                  r'(\d+vm\d+t|\d+dcr\d+t|\d+dcr\d+c).*$')
-    vals = dict()
-
     # Transform the data
     logging.info(
         f"    Creating the data set for the {plot.get(u'type', u'')} "
@@ -1531,6 +1541,7 @@ def plot_nf_heatmap(plot, input_data):
 
     for ttype in plot.get(u"test-type", (u"ndr", u"pdr")):
         for core in plot.get(u"core", tuple()):
+            vals = dict()
             for item in plot.get(u"include", tuple()):
                 reg_ex = re.compile(str(item.format(core=core)).lower())
                 for job in in_data: