Move common storage, plot and statistic code to cephlib
diff --git a/wally/console_report.py b/wally/console_report.py
index ac54965..1528089 100644
--- a/wally/console_report.py
+++ b/wally/console_report.py
@@ -4,13 +4,13 @@
import numpy
from cephlib.common import float2str
+from cephlib import texttable
+from cephlib.statistic import calc_norm_stat_props, calc_histo_stat_props
-from . import texttable
-from .hlstorage import ResultStorage
+from .result_classes import IResultStorage
from .stage import Stage, StepOrder
from .test_run_class import TestRun
from .suits.io.fio import FioTest
-from .statistic import calc_norm_stat_props, calc_histo_stat_props
from .suits.io.fio_hist import get_lat_vals
from .data_selectors import get_aggregated
@@ -23,22 +23,23 @@
priority = StepOrder.REPORT
def run(self, ctx: TestRun) -> None:
- rstorage = ResultStorage(ctx.storage)
- for suite in rstorage.iter_suite(FioTest.name):
+ for suite in ctx.rstorage.iter_suite(FioTest.name):
table = texttable.Texttable(max_width=200)
- tbl = rstorage.get_txt_report(suite)
+ tbl = ctx.rstorage.get_txt_report(suite)
if tbl is None:
table.header(["Description", "IOPS ~ Dev", "BW, MiBps", 'Skew/Kurt', 'lat med, ms', 'lat 95, ms'])
table.set_cols_align(('l', 'r', 'r', 'r', 'r', 'r'))
- for job in sorted(rstorage.iter_job(suite), key=lambda job: job.params):
- bw_ts = get_aggregated(rstorage, suite, job, metric='bw')
+ for job in sorted(ctx.rstorage.iter_job(suite), key=lambda job: job.params):
+ bw_ts = get_aggregated(ctx.rstorage, suite.storage_id, job.storage_id, metric='bw',
+ trange=job.reliable_info_range_s)
props = calc_norm_stat_props(bw_ts)
avg_iops = props.average // job.params.params['bsize']
iops_dev = props.deviation // job.params.params['bsize']
- lat_ts = get_aggregated(rstorage, suite, job, metric='lat')
+ lat_ts = get_aggregated(ctx.rstorage, suite.storage_id, job.storage_id, metric='lat',
+ trange=job.reliable_info_range_s)
bins_edges = numpy.array(get_lat_vals(lat_ts.data.shape[1]), dtype='float32') / 1000 # convert us to ms
lat_props = calc_histo_stat_props(lat_ts, bins_edges)
table.add_row([job.params.summary,
@@ -48,5 +49,5 @@
float2str(lat_props.perc_50), float2str(lat_props.perc_95)])
tbl = table.draw()
- rstorage.put_txt_report(suite, tbl)
+ ctx.rstorage.put_txt_report(suite, tbl)
print(tbl)