[or-cvs] r18124: {torflow} Yet more testing changes. Also fix another exit policy issue (torflow/trunk/CircuitAnalysis/BuildTimes)

mikeperry at seul.org mikeperry at seul.org
Fri Jan 16 02:40:21 UTC 2009


Author: mikeperry
Date: 2009-01-15 21:40:21 -0500 (Thu, 15 Jan 2009)
New Revision: 18124

Modified:
   torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py
   torflow/trunk/CircuitAnalysis/BuildTimes/dist_check.py
   torflow/trunk/CircuitAnalysis/BuildTimes/full_run.sh
Log:

Yet more testing changes. Also fix another exit policy issue.



Modified: torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py	2009-01-16 00:00:53 UTC (rev 18123)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py	2009-01-16 02:40:21 UTC (rev 18124)
@@ -46,6 +46,7 @@
   def __init__(self,c, selmgr,basefile_name,nstats):
     StatsHandler.__init__(self,c, selmgr)
     self.nodesfile = open(basefile_name + '.nodes','w')
+    self.failfile = open(basefile_name + '.failed','w')
     self.extendtimesfile = open(basefile_name + '.extendtimes','w')
     self.buildtimesfile = open(basefile_name + '.buildtimes','w')
     self.circ_built = 0
@@ -61,8 +62,8 @@
     self.selmgr.exit_rstr.add_restriction(OrNodeRestriction([
                   ExitPolicyRestriction("255.255.255.255", 80), 
                   ExitPolicyRestriction("255.255.255.255", 443)]))
-
-
+    self.selmgr.path_selector.exit_gen.rebuild()
+    
   def circ_status_event(self, circ_event):
     """ handles circuit status event """
     if circ_event.circ_id in self.circuits:
@@ -76,7 +77,7 @@
         buildtime = reduce(lambda x,y:x+y,circ.extend_times,0.0)
         self.extendtimesfile.write(str(circ.circ_id)+'\t'+'\t'.join(map(str, circ.extend_times))+'\n')
         self.extendtimesfile.flush()
-        self.nodesfile.write(str(circ.circ_id)+'\t'+'\t'.join(self.circuits[circ_event.circ_id].id_path())+'\n')
+        self.nodesfile.write(str(circ.circ_id)+'\t'+'\t'.join(circ.id_path())+'\n')
         self.nodesfile.flush()
         self.buildtimesfile.write(str(circ.circ_id) + '\t' + str(buildtime) + '\n')
         self.buildtimesfile.flush()
@@ -85,6 +86,12 @@
       if circ_event.status == 'BUILT': 
         self.circ_built += 1
         self.close_circuit(circ_event.circ_id)
+
+      if circ_event.status == 'FAILED':
+        circ = self.circuits[circ_event.circ_id]
+        # Record it to the failed file..
+        self.failfile.write(str(circ.circ_id)+'\t'+'\t'.join(circ.id_path())+'\n')
+        self.failfile.flush()
     StatsHandler.circ_status_event(self,circ_event)
 
 def cleanup():
@@ -179,6 +186,7 @@
     basefile_name = dirname + '/' + str(p) + '-' + str(s) + '.' + str(ncircuits)
 
   aggfile_name =  basefile_name + '.agg'
+  uptime_name = basefile_name + '.uptime'
 
   # Ok, since we create a new StatsGatherer each segment..
   __selmgr.percent_fast = s
@@ -229,6 +237,14 @@
     cond.acquire()
     h.close_all_circuits()
     h.write_stats(aggfile_name)
+
+    f = open(uptime_name, "w")
+    # Write out idhex+uptime info
+    for r in h.sorted_r:
+      f.write(r.idhex+"\t"+str(r.current_uptime())+"\n")
+
+    f.flush()
+    f.close()
     cond.notify()
     cond.release()
     print "Wrote stats."

Modified: torflow/trunk/CircuitAnalysis/BuildTimes/dist_check.py
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/dist_check.py	2009-01-16 00:00:53 UTC (rev 18123)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/dist_check.py	2009-01-16 02:40:21 UTC (rev 18124)
@@ -56,6 +56,7 @@
   def __init__(self, router):
     self.__dict__ = router.__dict__
     self.chosen = [0,0,0]
+    self.uptime = 0
 
 
 def main():
@@ -70,8 +71,20 @@
   routers.sort(lambda x, y: cmp(y.bw, x.bw))
   for i in xrange(len(routers)): routers[i].list_rank = i
 
-  f = open(pathfile, "r")
+  f = open(pathfile+".nodes", "r")
+  ok_circs = f.readlines()
+  f.close()
+    
+  f = open(pathfile+".failed", "r")
+  failed_circs = f.readlines()
+  f.close()
 
+  uptimes = open(pathfile+".uptime", "r")
+  for line in uptimes:
+    nodes = map(lambda n: n.strip(), line.split("\t"))
+    if nodes[0] in router_map:
+      router_map[nodes[0]].uptime = float(nodes[1])/60.0
+
   pct_mins = [100, 100, 100]
   pct_maxes = [0, 0, 0]
   flags = [{},{},{}]
@@ -83,7 +96,7 @@
                   ExitPolicyRestriction("255.255.255.255", 80),
                   ExitPolicyRestriction("255.255.255.255", 443)])
   
-  for line in f:
+  for line in ok_circs+failed_circs:
     nodes = map(lambda n: n.strip(), line.split("\t"))
     id,nodes = (nodes[0],nodes[1:])
     circuits+=1
@@ -123,7 +136,7 @@
     unchosen = 0
     for r in routers:
       if r.chosen[i] == 0: unchosen+=1
-      else: print r.idhex+" "+str((100.0*r.list_rank)/len(routers))+"%, chosen: "+str(r.chosen[i])
+      else: print r.idhex+" "+str(round((100.0*r.list_rank)/len(routers),2))+"%, chosen: "+str(r.chosen[i])+", up: "+str(round(r.uptime,2))
 
     print "Nodes not chosen for this hop: "+str(unchosen)+"/"+str(len(routers))
 
@@ -135,7 +148,10 @@
       else:
         print f+": "+str(flags[i][f])
 
+  # FIXME: Print out summaries for failure information for some routers
+  
 
+
   print "Routers used that are still present: "+str(len(present.keys()))
   print "Routers used that are now absent: "+str(len(absent.keys()))
   print "Min percentiles per hop: "+str(pct_mins)

Modified: torflow/trunk/CircuitAnalysis/BuildTimes/full_run.sh
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/full_run.sh	2009-01-16 00:00:53 UTC (rev 18123)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/full_run.sh	2009-01-16 02:40:21 UTC (rev 18124)
@@ -7,7 +7,8 @@
 # Check all slices
 for f in ./slices/*.nodes
 do
-  ./dist_check.py -f ${f} >& ${f}.check
+  base = `basename ${f} .nodes`
+  ./dist_check.py -f ${base} >& ${base}.check
   mv ${f} ${f}.checked
 done
 
@@ -16,7 +17,8 @@
 # Check all slices
 for f in ./slices/*.nodes
 do
-  ./dist_check.py -f ${f} >& ${f}.check
+  base = `basename ${f} .nodes`
+  ./dist_check.py -f $base >& ${base}.check
   mv ${f} ${f}.checked
 done
 
@@ -25,7 +27,8 @@
 # Check all slices
 for f in ./slices/*.nodes
 do
-  ./dist_check.py -f ${f} >& ${f}.check
+  base = `basename ${f} .nodes`
+  ./dist_check.py -f ${base} >& ${base}.check
   mv ${f} ${f}.checked
 done
 



More information about the tor-commits mailing list