commit f0437bf02c46d2d67e3da02d0b21813a2a3943ed Author: juga0 juga@riseup.net Date: Tue Oct 23 11:05:23 2018 +0000
Add statistics in the header before scaling too
It can be the case that after selecting the results to consider and before scaling, there is not any. In this case the statistics should also be written in the header. --- sbws/lib/v3bwfile.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py index b1bdbff..ef0c7f9 100644 --- a/sbws/lib/v3bwfile.py +++ b/sbws/lib/v3bwfile.py @@ -491,7 +491,14 @@ class V3BWFile(object): if line is not None: bw_lines_raw.append(line) if not bw_lines_raw: - log.info("There are not enough raw results to apply any scaling.") + log.info("After applying restrictions to the raw results, " + "there is not any. Scaling can not be applied.") + if num_net_relays is not None: + statsd, success = cls.measured_progress_stats(bw_lines_raw, + num_net_relays, state_fpath) + if not success: + header.add_stats(**statsd) + bw_lines = [] return cls(header, []) if scaling_method == SBWS_SCALING: bw_lines = cls.bw_sbws_scale(bw_lines_raw, scale_constant)
tor-commits@lists.torproject.org