[tor-commits] [sbws/master] Scale as Torflow by default when running generate

juga at torproject.org juga at torproject.org
Mon Oct 8 10:26:08 UTC 2018


commit 835255703d582964a0e564d81a7848e87c5568cd
Author: juga0 <juga at riseup.net>
Date:   Mon Oct 8 09:22:30 2018 +0000

    Scale as Torflow by default when running generate
---
 sbws/core/generate.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sbws/core/generate.py b/sbws/core/generate.py
index 637a956..6a6226b 100644
--- a/sbws/core/generate.py
+++ b/sbws/core/generate.py
@@ -38,9 +38,13 @@ def gen_parser(sub):
                    'are, but scale them such that we have a budget of '
                    'scale_constant * num_measured_relays = bandwidth to give '
                    'out, and we do so proportionally')
-    p.add_argument('-t', '--scale-torflow', action='store_true',
+    p.add_argument('-t', '--scale-torflow', action='store_const',
+                   default=True, const=False,
                    help='If specified, do not use bandwidth values as they '
                    'are, but scale them in the way Torflow does.')
+    p.add_argument('-w', '--raw', action='store_true',
+                   help='If specified, do use bandwidth raw measurements '
+                   'without any scaling.')
     p.add_argument('-m', '--torflow-bw-margin', default=TORFLOW_BW_MARGIN,
                    type=float,
                    help="Cap maximum bw when scaling as Torflow. ")
@@ -71,10 +75,10 @@ def main(args, conf):
         fail_hard('toflow-bw-margin must be major than 0.')
     if args.scale_sbws:
         scaling_method = SBWS_SCALING
-    elif args.scale_torflow:
-        scaling_method = TORFLOW_SCALING
-    else:
+    elif args.raw:
         scaling_method = None
+    else:
+        scaling_method = TORFLOW_SCALING
 
     fresh_days = conf.getint('general', 'data_period')
     reset_bw_ipv4_changes = conf.getboolean('general', 'reset_bw_ipv4_changes')





More information about the tor-commits mailing list