[or-cvs] r22276: {torflow} Attempt to log which scanners have crashed during aggregate. (torflow/trunk/NetworkScanners/BwAuthority)

Mike Perry mikeperry-svn at fscked.org
Tue May 4 17:12:50 UTC 2010


Author: mikeperry
Date: 2010-05-04 17:12:50 +0000 (Tue, 04 May 2010)
New Revision: 22276

Modified:
   torflow/trunk/NetworkScanners/BwAuthority/aggregate.py
Log:

Attempt to log which scanners have crashed during aggregate.



Modified: torflow/trunk/NetworkScanners/BwAuthority/aggregate.py
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/aggregate.py	2010-05-04 16:49:10 UTC (rev 22275)
+++ torflow/trunk/NetworkScanners/BwAuthority/aggregate.py	2010-05-04 17:12:50 UTC (rev 22276)
@@ -280,7 +280,7 @@
   # Take the most recent timestamp from each scanner 
   # and use the oldest for the timestamp of the result.
   # That way we can ensure all the scanners continue running.
-  scanner_timestamps = []
+  scanner_timestamps = {}
   for da in argv[1:-1]:
     # First, create a list of the most recent files in the
     # scan dirs that are recent enough
@@ -309,7 +309,7 @@
                 if slicenum not in timestamps or \
                      timestamps[slicenum] < timestamp:
                   timestamps[slicenum] = timestamp
-          scanner_timestamps.append(newest_timestamp)
+          scanner_timestamps[ds] = newest_timestamp
 
   # Need to only use most recent slice-file for each node..
   for (s,t,f) in bw_files:
@@ -443,11 +443,11 @@
   n_print = nodes.values()
   n_print.sort(lambda x,y: int(y.change) - int(x.change))
 
-  scan_age = int(round(min(scanner_timestamps),0))
+  for scanner in scanner_timestamps.iterkeys():
+    scan_age = int(round(scanner_timestamps[scanner],0))
+    if scan_age < time.time() - MAX_SCAN_AGE:
+      plog("WARN", "Bandwidth scanner "+scanner+" stale. Possible dead bwauthority.py. Timestamp: "+time.ctime(scan_age))
 
-  if scan_age < time.time() - MAX_SCAN_AGE:
-    plog("WARN", "Bandwidth scan stale. Possible dead bwauthority.py. Timestamp: "+time.ctime(scan_age))
-
   out = file(argv[-1], "w")
   out.write(str(scan_age)+"\n")
 



More information about the tor-commits mailing list