[tor-commits] [sbws/master] Create bwfile passing consensus path
juga at torproject.org
juga at torproject.org
Wed Oct 24 09:40:23 UTC 2018
commit 06af6d34c22006f1f26fc10e2d78a825a7c7d883
Author: juga0 <juga at riseup.net>
Date: Thu Oct 18 21:48:38 2018 +0000
Create bwfile passing consensus path
and rm condition about whether the min percentage of measured
relays was reached. It will be checked when writing the file.
Also pass the arg rm_link to write.
---
sbws/core/generate.py | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/sbws/core/generate.py b/sbws/core/generate.py
index f147993..66c9d7d 100644
--- a/sbws/core/generate.py
+++ b/sbws/core/generate.py
@@ -1,7 +1,7 @@
from sbws.globals import (fail_hard, SBWS_SCALE_CONSTANT, TORFLOW_SCALING,
SBWS_SCALING, TORFLOW_BW_MARGIN, TORFLOW_ROUND_DIG,
DAY_SECS, NUM_MIN_RESULTS)
-from sbws.lib.v3bwfile import V3BWFile, is_min_percent_measured
+from sbws.lib.v3bwfile import V3BWFile
from sbws.lib.resultdump import load_recent_results_in_datadir
from argparse import ArgumentDefaultsHelpFormatter
import os
@@ -95,21 +95,18 @@ def main(args, conf):
'ran sbws scanner recently?)')
return
state_fpath = conf.getpath('paths', 'state_fname')
+ consensus_path = os.path.join(conf.getpath('tor', 'datadir'),
+ "cached-consensus")
bw_file = V3BWFile.from_results(results, state_fpath, args.scale_constant,
scaling_method,
torflow_cap=args.torflow_bw_margin,
torflow_round_digs=args.torflow_round_digs,
secs_recent=args.secs_recent,
secs_away=args.secs_away,
- min_num=args.min_num)
+ min_num=args.min_num,
+ consensus_path=consensus_path)
output = args.output or \
conf.getpath('paths', 'v3bw_fname').format(now_fname())
- # Check percentage of measured relays.
- consensus_path = os.path.join(conf.getpath('tor', 'datadir'),
- "cached-consensus")
- if is_min_percent_measured(consensus_path):
- bw_file.write(output)
- else:
- bw_file.rm_link(output)
+ bw_file.write(output, args.rm_link)
bw_file.info_stats
More information about the tor-commits
mailing list