fixed displaying charts
diff --git a/report.py b/report.py
index 430664f..a9d717d 100644
--- a/report.py
+++ b/report.py
@@ -6,6 +6,10 @@
import storage_api
+OPERATIONS = ('sync', ('randwrite a', 'randread a', 'write a', 'read a'),
+ 'async', ('randwrite s', 'randread s', 'write s', 'read s'))
+
+
def ssize_to_kb(ssize):
try:
smap = dict(k=1, K=1, M=1024, m=1024, G=1024**2, g=1024**2)
@@ -46,33 +50,29 @@
data[keys[2]][build] = {}
data[keys[2]][build][' '.join([keys[0], keys[1]])] = value
- scale_x_a = ['randwrite a', 'randread a', 'write a', 'read a']
- scale_x_s = ['randwrite s', 'randread s', 'write s', 'read s']
-
for name, value in data.items():
- title = name
- legend = []
- dataset_s = []
- dataset_a = []
+ for op_type, operations in OPERATIONS:
+ title = name
+ legend = []
+ dataset = []
- for build_id, build_results in value.items():
- legend.append(build_id)
- # import pdb;pdb.set_trace()
- ordered_build_results_s = OrderedDict(
- sorted([(k, v) for k, v in build_results.items()
- if k in scale_x_s], key=lambda t: scale_x_s.index(t[0])))
- ordered_build_results_a = OrderedDict(
- sorted([(k, v) for k, v in build_results.items()
- if k in scale_x_a], key=lambda t: scale_x_a.index(t[0])))
+ scale_x = []
- dataset_s.append(ordered_build_results_s.values())
- dataset_a.append(ordered_build_results_a.values())
+ for build_id, build_results in value.items():
+ vals = []
- bar_s = charts.render_vertical_bar(title, legend, dataset_s,
- scale_x=scale_x_s)
- bar_a = charts.render_vertical_bar(title, legend, dataset_a,
- scale_x=scale_x_a)
- charts_url.extend([str(bar_s), str(bar_a)])
+ for key in operations:
+ res = build_results.get(key)
+ if res:
+ vals.append(res)
+ scale_x.append(key)
+ if vals:
+ dataset.append(vals)
+ legend.append(build_id)
+
+ if dataset:
+ charts_url.append(str(charts.render_vertical_bar
+ (title, legend, dataset, scale_x=scale_x)))
return charts_url