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

[minion-cvs] Fix another ping scheduler bug. Now, at long last, int...



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv26552/lib/mixminion/server

Modified Files:
	Pinger.py 
Log Message:
Fix another ping scheduler bug.  Now, at long last, interesting chains get pinged frequently.

Index: Pinger.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Pinger.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- Pinger.py	1 Jan 2005 21:25:28 -0000	1.24
+++ Pinger.py	1 Jan 2005 21:56:03 -0000	1.25
@@ -946,14 +946,15 @@
 
         isInteresting = ((nSent < 3 and nReceived == 0) or
                          (product and frac <= product*0.3))
-        if isInteresting:#XXXX008 this is too verbose for a release version.
-            if nSent < 3 and nReceived == 0:
-                LOG.trace("%s,%s is interesting because %d were sent and %d were received",
-                          s1,s2, nSent, nReceived)
-            elif product and frac <= product*0.3:
-                LOG.trace("%s,%s is interesting because its reliability is %s and we expected a reliability of %s", s1,s2,frac, product)
-            else:
-                LOG.trace("I have no idea why %s,%s is interesting.",s1,s2)
+        if 0:
+            if isInteresting:
+                if nSent < 3 and nReceived == 0:
+                    LOG.trace("%s,%s is interesting because %d were sent and %d were received",
+                              s1,s2, nSent, nReceived)
+                elif product and frac <= product*0.3:
+                    LOG.trace("%s,%s is interesting because its reliability is %s and we expected a reliability of %s", s1,s2,frac, product)
+                else:
+                    LOG.trace("I have no idea why %s,%s is interesting.",s1,s2)
 
         return nSent, nReceived, isBroken, isInteresting
 
@@ -1237,17 +1238,23 @@
         path = tuple([ p.lower() for p in path ])
 
         interval = self._getPingInterval(path)
-        t = periodStart + self._getPerturbation(path, periodStart, interval)
+        perturbation = self._getPerturbation(path, periodStart, interval)
+        t = periodStart + perturbation
         t += interval * ceilDiv(now-t, interval)
         if t>periodEnd:
-            t = periodEnd+self._getPerturbation(path,
-                                                periodEnd,
-                                                interval)
+            periodStart = periodEnd
+            perturbation = self._getPerturbation(path,
+                                                 periodStart,
+                                                 interval)
+            t = periodStart+perturbation
+
         oldTime = self.nextPingTime.get(path, None)
         self.nextPingTime[path] = t
         if oldTime != t:
             LOG.trace("Scheduling %d-hop ping for %s at %s", len(path),
                       ",".join(path), formatTime(t,1))
+            #LOG.trace("(Period starts at %s; period is %s days; interval is %s sec; perturbation is %s sec)",
+            #          formatTime(periodStart,1), self._period_length/ONE_DAY, interval, perturbation)
         return t
     def _getPerturbation(self, path, periodStart, interval):
         """Return the offset to be used for the ping intervals for 'path'
@@ -1353,10 +1360,12 @@
                 self._schedulePing((n1,n2),now)
 
     def _getPingInterval(self, path):
-        p = "".join([ s.lower() for s in path])
+        p = ",".join([ s.lower() for s in path])
         if self.pingLog._interestingChains.get(p, 0):
+            #LOG.trace("While scheduling, I decided that %s was interesting",p)
             return self._interesting_interval
         else:
+            #LOG.trace("While scheduling, I decided that %s was dull",p)
             return self._dull_interval
 
     def sendPings(self, now=None):