[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r21406: {torflow} Change how the run redo works. Make it run as specified in t (torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test)



Author: mikeperry
Date: 2010-01-12 16:55:41 +0000 (Tue, 12 Jan 2010)
New Revision: 21406

Modified:
   torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbttest.py
   torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/run_test.sh
Log:

Change how the run redo works. Make it run as specified in
the outline. Also fix some bugs.



Modified: torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbttest.py
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbttest.py	2010-01-11 22:19:52 UTC (rev 21405)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbttest.py	2010-01-12 16:55:41 UTC (rev 21406)
@@ -154,6 +154,7 @@
     self.cond = cond
     self.reset()
     self.reset_total = 0
+    self.redo_cnt = 0
     self.timeouts_file = file(output_dir+"/timeouts", "w")
 
   def reset(self):
@@ -182,6 +183,14 @@
     # over? Probably, but then that breaks a lot of our asserts
     # below...
     if bt_event.set_type == "RESET":
+      if redo_run:
+        plog("WARN", "Got reset during redo")
+        self.cond.acquire()
+        self.cond.num_circs = -1
+        self.cond.num_timeout = -1
+        self.cond.notify()
+        self.cond.release()
+        return
       plog("NOTICE", "Got RESET event. Resetting counts")
       self.reset_total += self.total_times
       self.reset()
@@ -198,6 +207,19 @@
     if not self.buildtimeout_fuzzy:
       self.buildtimeout_fuzzy = bt_event
 
+    if redo_run:
+      if not self.redo_cnt:
+        self.redo_cnt = bt_event.total_times*2
+      elif bt_event.total_times >= self.redo_cnt:
+        plog("NOTICE", "Redo count reached at "+str(bt_event.total_times/2))
+        shutil.copyfile('./tor-data/state', output_dir+"/state.full")
+        self.cond.acquire()
+        self.cond.num_circs = self.redo_cnt/2
+        self.cond.num_timeout = bt_event.timeout_ms
+        self.cond.notify()
+        self.cond.release()
+        return
+
     fuzzy_last = int(self.buildtimeout_fuzzy.timeout_ms)
     fuzzy_curr = int(bt_event.timeout_ms)
     fuzzy_diff = abs(fuzzy_last-fuzzy_curr)
@@ -229,7 +251,8 @@
     if strict_diff > self.buildtimeout_strict.timeout_ms*STRICT_DEV:
       self.buildtimeout_strict = None
       self.strict_streak_count = 0
-    else:
+      self.cond.num_circs = 0
+    elif not self.cond.num_circs:
       if (self.strict_streak_count != (bt_event.total_times -
                  self.buildtimeout_strict.total_times)):
         plog("WARN",
@@ -245,13 +268,14 @@
              +str(self.total_times-self.strict_streak_count)
              +" with streak of "+str(self.strict_streak_count)
              +" and reset count of "+str(self.reset_total))
-        shutil.copyfile('./tor-data/state', output_dir+"/state.full")
-        self.cond.acquire()
-        self.cond.num_circs = self.reset_total+self.total_times-\
-                                  self.strict_streak_count
-        self.cond.num_timeout = bt_event.timeout_ms
-        self.cond.notify()
-        self.cond.release()
+        if not redo_run:
+          shutil.copyfile('./tor-data/state', output_dir+"/state.full")
+          self.cond.acquire()
+          self.cond.num_circs = self.reset_total+self.total_times-\
+                                    self.strict_streak_count
+          self.cond.num_timeout = bt_event.timeout_ms
+          self.cond.notify()
+          self.cond.release()
 
 def get_guards(c, n):
   # Get list of live routers
@@ -332,8 +356,9 @@
   # 2. Guards used
   # 3. Failure quantile (in rerun only)
   out = file(output_dir+"/result", "w")
-  out.write("MIN_CIRCS: "+str(cond.min_circs)+"\n")
-  out.write("MIN_TIMEOUT: "+str(cond.min_timeout)+"\n")
+  if not redo_run:
+    out.write("MIN_CIRCS: "+str(cond.min_circs)+"\n")
+    out.write("MIN_TIMEOUT: "+str(cond.min_timeout)+"\n")
   out.write("NUM_CIRCS: "+str(cond.num_circs)+"\n")
   out.write("NUM_TIMEOUT: "+str(cond.num_timeout)+"\n")
   timeout_cnt = len(h.timeout_circs)

Modified: torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/run_test.sh
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/run_test.sh	2010-01-11 22:19:52 UTC (rev 21405)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/run_test.sh	2010-01-12 16:55:41 UTC (rev 21406)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# TODO:
+# OUTLINE:
 # 1. Fire up a Tor
 # 2. For every 5% percentile, loop N times:
 # 3.   Remove state file + hup tor.
@@ -45,10 +45,10 @@
   fi
 fi
 
-for p in 0 10 # 20 30 40 50 60 70 80 90
+for p in 0 10 20 30 40 50 60 70 80 90
 do
   N=0
-  while [ $N -lt 2 ] #10 ]
+  while [ $N -lt 10 ]
   do
     if [ -f $TOR_DATA/tor.pid ]; then
       kill `cat $TOR_DATA/tor.pid`
@@ -68,7 +68,7 @@
   for n in `ls -1 results/$p`
   do
     M=0
-    while [ $M -lt 2 ] # 3 ]
+    while [ $M -lt 10 ]
     do
       if [ -f $TOR_DATA/tor.pid ]; then
         kill `cat $TOR_DATA/tor.pid`
@@ -78,8 +78,8 @@
       $TOR_DIR/tor -f $TOR_DATA/torrc &
       sleep 10
       mkdir -p results/$p/$n/redo.$M
-      ./cbttest.py -p $p -o results/$p/$n/redo.$M |& tee results/$p/$n/redo.$M/cbt.log || exit
-      M=`expr $N + 1`
+      ./cbttest.py -r -p $p -o results/$p/$n/redo.$M |& tee results/$p/$n/redo.$M/cbt.log || exit
+      M=`expr $M + 1`
     done
   done
 done