[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-tasks/master] Fail gracefully for old consensus
commit cc86e841928a7a85168143ff524b0779c0e5059a
Author: Sathyanarayanan <gsathya.ceg@xxxxxxxxx>
Date: Mon Jul 9 16:57:08 2012 +0300
Fail gracefully for old consensus
---
task-6232/pyentropy.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/task-6232/pyentropy.py b/task-6232/pyentropy.py
index 0ae0f25..23850d1 100644
--- a/task-6232/pyentropy.py
+++ b/task-6232/pyentropy.py
@@ -61,8 +61,8 @@ def run(file_name):
totalExitBW += router.bandwidth
if len(routers) <= 0:
- print "Error: amount of routers must be > 0."
- return;
+ print "Error: Old consensus file. Not able to parse."
+ return
entropy, entropy_exit, entropy_guard = 0.0, 0.0, 0.0
for router in routers:
@@ -92,4 +92,5 @@ if __name__ == "__main__":
with open(sys.argv[2], 'w') as f:
for file_name in os.listdir(sys.argv[1]):
string = run(os.path.join(sys.argv[1], file_name))
- f.write("%s\n" % (string))
+ if string:
+ f.write("%s\n" % (string))
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits