Skip to content

Commit

Permalink
Remove redundant tags from labels
Browse files Browse the repository at this point in the history
  • Loading branch information
dianaclarke committed Sep 8, 2021
1 parent 5eaf854 commit 4138077
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
9 changes: 8 additions & 1 deletion conbench/app/_plots.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import collections
import json

import bokeh.plotting
Expand Down Expand Up @@ -69,7 +70,7 @@ def _simple_source(data, unit):
points_formated, units_formatted = [], set()

for *values, point in data:
cases.append("-".join(values))
cases.append(values)
points.append(point)
formatted = unit_fmt(float(point), unit)
means.append(formatted)
Expand All @@ -85,6 +86,12 @@ def _simple_source(data, unit):
if axis_unit == unit:
axis_unit = get_display_unit(unit)

# remove redundant tags from labels
len_cases = len(cases)
counts = collections.Counter([tag for case in cases for tag in case])
stripped = [[tag for tag in case if counts[tag] != len_cases] for case in cases]
cases = ["-".join(tags) for tags in stripped]

source_data = dict(x=cases, y=points, means=means)
return bokeh.models.ColumnDataSource(data=source_data), axis_unit

Expand Down
25 changes: 25 additions & 0 deletions conbench/tests/app/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,28 @@ def test_simple_source_units_not_uniform_items_per_second():
"983.070182 i/s",
"138.696 M i/s",
]


def test_simple_source_omit_redundant_labels():
data = [
["table", "tag=1", "tag 2", "100"],
["download", "tag=2", "tag 2", "200"],
["parquet", "tag=3", "tag 2", "300"],
]
source, axis_unit = _simple_source(data, "s")
assert axis_unit == "seconds"
assert source.data["x"] == [
"table-tag=1",
"download-tag=2",
"parquet-tag=3",
]
assert source.data["y"] == [
"100.000",
"200.000",
"300.000",
]
assert source.data["means"] == [
"100.000 s",
"200.000 s",
"300.000 s",
]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name="conbench",
version="1.18.0",
version="1.19.0",
description="Continuous Benchmarking (CB) Framework",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 4138077

Please sign in to comment.