- y_val = test_data.get("LOWER", None)
- if y_val:
- y_val /= 1000000
- if y_val > y_max:
- y_max = y_val
-
- time = "No Information"
- result = "No Information"
- hovertext = ("{name}<br>"
- "Packet Throughput: {val:.2f}Mpps<br>"
- "Final Duration: {time}<br>"
- "Result: {result}".format(name=name,
- val=y_val,
- time=time,
- result=result))
- traces.append(plgo.Bar(x=[str(idx) + '.', ],
- y=[y_val, ],
- name=name,
- text=hovertext,
- hoverinfo="text"))
- try:
- # Create plot
- layout = deepcopy(plot["layout"])
- if layout.get("title", None):
- layout["title"] = "<b>Packet Throughput:</b> {0}". \
- format(layout["title"])
- if y_max:
- layout["yaxis"]["range"] = [0, y_max + 1]
- plpl = plgo.Figure(data=traces, layout=layout)
- # Export Plot
- logging.info(" Writing file '{0}{1}'.".
- format(plot["output-file"], plot["output-file-type"]))
- ploff.plot(plpl, show_link=False, auto_open=False,
- filename='{0}{1}'.format(plot["output-file"],
- plot["output-file-type"]))
- except PlotlyError as err:
- logging.error(" Finished with error: {}".
- format(repr(err).replace("\n", " ")))
- return
-
-
-def plot_soak_boxes(plot, input_data):
- """Generate the plot(s) with algorithm: plot_soak_boxes
- 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
- plot_title = plot.get("title", "")
- logging.info(" Creating the data set for the {0} '{1}'.".
- format(plot.get("type", ""), plot_title))
- data = input_data.filter_data(plot)
- if data is None:
- logging.error("No data.")
- return
-
- # Prepare the data for the plot
- y_vals = dict()
- y_tags = dict()
- for job in data:
- for build in job:
- for test in build:
- if y_vals.get(test["parent"], None) is None:
- y_tags[test["parent"]] = test.get("tags", None)
- try:
- if test["type"] in ("SOAK", ):
- y_vals[test["parent"]] = test["throughput"]
- else:
- continue
- except (KeyError, TypeError):
- y_vals[test["parent"]] = dict()
-
- # Sort the tests
- order = plot.get("sort", None)
- if order and y_tags:
- y_sorted = OrderedDict()
- y_tags_l = {s: [t.lower() for t in ts] for s, ts in y_tags.items()}
- for tag in order:
- logging.debug(tag)
- for suite, tags in y_tags_l.items():
- if "not " in tag:
- tag = tag.split(" ")[-1]
- if tag.lower() in tags:
- continue
- else:
- if tag.lower() not in tags:
- continue
- try:
- y_sorted[suite] = y_vals.pop(suite)
- y_tags_l.pop(suite)
- logging.debug(suite)
- except KeyError as err:
- logging.error("Not found: {0}".format(repr(err)))
- finally:
- break
- else:
- y_sorted = y_vals