[CalendarServer-changes] [2549] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 6 12:35:11 PDT 2008


Revision: 2549
          http://trac.macosforge.org/projects/calendarserver/changeset/2549
Author:   dreid at apple.com
Date:     2008-06-06 12:35:10 -0700 (Fri, 06 Jun 2008)

Log Message:
-----------
Allow ./run to pass a reactor argument to twisted, also add support for setting the child process reactor in the config file.

Modified Paths:
--------------
    CalendarServer/trunk/bin/caldavd
    CalendarServer/trunk/run
    CalendarServer/trunk/twistedcaldav/cluster.py
    CalendarServer/trunk/twistedcaldav/config.py

Modified: CalendarServer/trunk/bin/caldavd
===================================================================
--- CalendarServer/trunk/bin/caldavd	2008-06-06 19:34:34 UTC (rev 2548)
+++ CalendarServer/trunk/bin/caldavd	2008-06-06 19:35:10 UTC (rev 2549)
@@ -27,6 +27,8 @@
 plugin_name="caldav";
 service_type="";
 profile="";
+twistd_reactor="";
+child_reactor=""
 
 py_version ()
 {
@@ -88,12 +90,13 @@
     echo "        -T Path to twistd binary";
     echo "        -t Process type (Master, Slave or Combined)";
     echo "        -p Path to the desired pstats file.";
+    echo "        -R The Twisted Reactor to run [${reactor}]";
 
     if [ "${1-}" == "-" ]; then return 0; fi;
     exit 64;
 }
 
-while getopts 'hXu:g:f:T:P:t:p:' option; do
+while getopts 'hXu:g:f:T:P:t:p:R:' option; do
     case "${option}" in
         '?') usage; ;;
         'h') usage -; exit 0; ;;
@@ -105,6 +108,7 @@
         'P') plugin_name="${OPTARG}"; ;;
         't') service_type="-o ProcessType=${OPTARG}"; ;;
         'p') profile="-o Profiling/Enabled=True -o Profiling/BaseDirectory=${OPTARG}"; ;;
+        'R') twistd_reactor="--reactor=${OPTARG}"; child_reactor="-o Twisted/reactor=${OPTARG}"; ;;
     esac;
 done;
 
@@ -114,4 +118,6 @@
 
 export PYTHONPATH
 
-exec "${python}" "${twistdpath}" ${daemonize} ${username} ${groupname} "${plugin_name}" ${configfile} ${service_type} ${profile};
+echo exec "${python}" "${twistdpath}" "${twistd_reactor}" ${daemonize} ${username} ${groupname} "${plugin_name}" ${configfile} ${service_type} ${profile} "${child_reactor}";
+
+exec "${python}" "${twistdpath}" ${twistd_reactor} ${daemonize} ${username} ${groupname} "${plugin_name}" ${configfile} ${service_type} ${profile} ${child_reactor};

Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run	2008-06-06 19:34:34 UTC (rev 2548)
+++ CalendarServer/trunk/run	2008-06-06 19:35:10 UTC (rev 2549)
@@ -42,6 +42,7 @@
  service_type="Combined";
      read_key="";
       profile="";
+      reactor="";
 
 usage ()
 {
@@ -49,7 +50,7 @@
 
   if [ "${1--}" != "-" ]; then echo "$@"; echo; fi;
 
-  echo "Usage: ${program} [-hvgsfnpdkr] [-K key] [-iI dst] [-t type] [-S statsdirectory] [-P plugin]";
+  echo "Usage: ${program} [-hvgsfnpdkrR] [-K key] [-iI dst] [-t type] [-S statsdirectory] [-P plugin]";
   echo "Options:";
   echo "	-h  Print this help and exit";
   echo "	-v  Be verbose";
@@ -67,12 +68,13 @@
   echo "        -t  Select the server process type (Master, Slave or Combined) [${service_type}]";
   echo "        -S  Write a pstats object for each process to the given directory when the server is stopped.";
   echo "	-P  Select the twistd plugin name [${plugin_name}]";
+  echo "        -R  Twisted Reactor plugin to execute [${reactor}]";
 
   if [ "${1-}" == "-" ]; then return 0; fi;
   exit 64;
 }
 
-while getopts 'hvgsfnpdkrK:i:I:t:S:P:' option; do
+while getopts 'hvgsfnpdkrK:i:I:t:S:P:R:' option; do
   case "$option" in
     '?') usage; ;;
     'h') usage -; exit 0; ;;
@@ -82,6 +84,7 @@
     'r')       restart="true"; ;;
     'd')     daemonize=""; ;;
     'P')   plugin_name="${OPTARG}"; ;;
+    'R')       reactor="-R ${OPTARG}"; ;;
     't')  service_type="${OPTARG}"; ;;
     'K')      read_key="${OPTARG}"; ;;
     'S')       profile="-p ${OPTARG}"; ;;
@@ -248,6 +251,7 @@
         -T "${twisted}/bin/twistd"           \
         -P "${plugin_name}"                  \
         -t "${service_type}"                 \
+        ${reactor}                         \
         ${profile};
     cd /;
   fi;

Modified: CalendarServer/trunk/twistedcaldav/cluster.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/cluster.py	2008-06-06 19:34:34 UTC (rev 2548)
+++ CalendarServer/trunk/twistedcaldav/cluster.py	2008-06-06 19:35:10 UTC (rev 2549)
@@ -93,7 +93,8 @@
             args.extend(('--savestats', '--nothotshot'))
 
         args.extend(
-            ['-n', self.tapname,
+            ['--reactor=%s' % (config.Twisted['reactor'],),
+             '-n', self.tapname,
              '-f', self.configFile,
              '-o', 'ProcessType=Slave',
              '-o', 'BindAddresses=%s' % (','.join(self.interfaces),),

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2008-06-06 19:34:34 UTC (rev 2548)
+++ CalendarServer/trunk/twistedcaldav/config.py	2008-06-06 19:35:10 UTC (rev 2549)
@@ -168,6 +168,7 @@
     # Twisted
     "Twisted": {
         "twistd": "/usr/share/caldavd/bin/twistd",
+        "reactor": "select",
     },
 
     # Python Director

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080606/33927394/attachment-0001.htm 


More information about the calendarserver-changes mailing list