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

[minion-cvs] Rewrite pinger to use pysqlite instead of having to kee...



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

Modified Files:
	Pinger.py ServerMain.py 
Log Message:
Rewrite pinger to use pysqlite instead of having to keep everything in memory or rescan disk over and over. eventually, we can move to supporting multiple DBs

Index: Pinger.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Pinger.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Pinger.py	7 Aug 2004 14:08:23 -0000	1.6
+++ Pinger.py	2 Dec 2004 06:47:08 -0000	1.7
@@ -14,6 +14,8 @@
    Third, we use the timing/uptime information in the second part
    above to try to infer how reliable the other nodes in the network
    are.
+
+   This module requires python 2.2 or later, and the sqlite module.
 """
 
 import bisect
@@ -38,646 +40,474 @@
      floorDiv, formatBase64, formatFnameDate, formatTime, LOG, parseFnameDate,\
      previousMidnight, readPickled, secureDelete, writePickled
[...1032 lines suppressed...]
-    return PingResults(results, summary)
+    def calculateDailyResults(self, server):
+        #XXXX
+        pass
 
 class PingGenerator:
     """DOCDOC"""
@@ -948,3 +778,12 @@
     pingers.append(TwoHopPingGenerator(config))
     pingers.append(TestLinkPaddingGenerator(config))
     return CompoundPingGenerator(pingers)
+
+def canRunPinger():
+    """DOCDOC"""
+    return sys.version_info[:2] >= (2,2) and sqlite is not None
+
+def openPingLog(location):
+    # FFFF eventually, we should maybe support more than pysqlite.  But let's
+    # FFFF not generalize until we have a 2nd case.
+    return PingLog(sqlite.connect(location))

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- ServerMain.py	7 Aug 2004 14:08:24 -0000	1.134
+++ ServerMain.py	2 Dec 2004 06:47:08 -0000	1.135
@@ -873,7 +873,7 @@
                        self.outgoingQueue.count())
 
         pingerEnabled = config['Pinging'].get("Enabled")
-        if pingerEnabled:
+        if pingerEnabled and mixminion.server.Pinger.canRunPinger():
             #FFFF Later, enable this stuff anyway, to make R-G-B mixing work.
             LOG.debug("Initializing ping log")
             pingerDir = os.path.join(config.getWorkDir(), "pinger")
@@ -885,6 +885,8 @@
 
             self.pingGenerator=mixminion.server.Pinger.getPingGenerator(config)
         else:
+            if pingerEnabled:
+                LOG.warn("Running a pinger requires Python 2.2 or later, and the pysqlite module")
             self.pingLog = None
             self.pingGenerator = None