[CalendarServer-changes] [6017] CalendarServer/trunk/calendarserver/tap
source_changes at macosforge.org
source_changes at macosforge.org
Mon Aug 9 13:19:41 PDT 2010
Revision: 6017
http://trac.macosforge.org/projects/calendarserver/changeset/6017
Author: exarkun at twistedmatrix.com
Date: 2010-08-09 13:19:40 -0700 (Mon, 09 Aug 2010)
Log Message:
-----------
Specify a pidfile for the slave instances
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/caldav.py
CalendarServer/trunk/calendarserver/tap/test/test_caldav.py
Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py 2010-08-09 18:24:28 UTC (rev 6016)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py 2010-08-09 20:19:40 UTC (rev 6017)
@@ -926,6 +926,19 @@
running a C{twistd} plugin, to be used by
L{DelayedStartupProcessMonitor.addProcessObject}.
+ @ivar twistd: The path to the twistd executable to launch.
+ @type twistd: C{str}
+
+ @ivar tapname: The name of the twistd plugin to launch.
+ @type tapname: C{str}
+
+ @ivar id: The instance identifier for this slave process.
+ @type id: C{int}
+
+ @ivar interfaces: A sequence of interface addresses which the process will
+ be configured to bind to.
+ @type interfaces: sequence of C{str}
+
@ivar inheritFDs: File descriptors to be inherited for calling accept() on
in the subprocess.
@type inheritFDs: C{list} of C{int}, or C{None}
@@ -1008,7 +1021,7 @@
"-f", self.configFile,
"-o", "ProcessType=Slave",
"-o", "BindAddresses=%s" % (",".join(self.interfaces),),
- "-o", "PIDFile=None",
+ "-o", "PIDFile=caldav-instance-%s.pid" % (self.id,),
"-o", "ErrorLogFile=None",
"-o", "ErrorLogEnabled=False",
"-o", "LogID=%s" % (self.id,),
Modified: CalendarServer/trunk/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/test/test_caldav.py 2010-08-09 18:24:28 UTC (rev 6016)
+++ CalendarServer/trunk/calendarserver/tap/test/test_caldav.py 2010-08-09 20:19:40 UTC (rev 6017)
@@ -1024,3 +1024,22 @@
self.assertEquals(oneProcessTransport.childFDs,
{0: 'w', 1: 'r', 2: 'r',
4: 4})
+
+
+
+class TwistdSlaveProcessTests(TestCase):
+ """
+ Tests for L{TwistdSlaveProcess}.
+ """
+ def test_pidfile(self):
+ """
+ The result of L{TwistdSlaveProcess.getCommandLine} includes an option
+ setting the name of the pidfile to something including the instance id.
+ """
+ slave = TwistdSlaveProcess("/path/to/twistd", "something", "config", 7, [])
+ commandLine = slave.getCommandLine()
+
+ option = 'PIDFile=caldav-instance-7.pid'
+ self.assertIn(option, commandLine)
+ self.assertEquals(commandLine[commandLine.index(option) - 1], '-o')
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100809/63f781b3/attachment-0001.html>
More information about the calendarserver-changes
mailing list