[Erp5-report] r11461 - /erp5/trunk/utils/oood/start.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 23 17:09:45 CET 2006


Author: kevin
Date: Thu Nov 23 17:09:44 2006
New Revision: 11461

URL: http://svn.erp5.org?rev=11461&view=rev
Log:
Update comments and log strings.
Minor modification of parameter handling.

Modified:
    erp5/trunk/utils/oood/start.py

Modified: erp5/trunk/utils/oood/start.py
URL: http://svn.erp5.org/erp5/trunk/utils/oood/start.py?rev=11461&r1=11460&r2=11461&view=diff
==============================================================================
--- erp5/trunk/utils/oood/start.py (original)
+++ erp5/trunk/utils/oood/start.py Thu Nov 23 17:09:44 2006
@@ -38,11 +38,13 @@
 
 
 """
-  Starts OOo instances to populate the pool.
   Size of the pool is defined in config under the 'pool_size' parameter.
-  Then user directories user_0, user_1 etc. will be created automatically
+
+  User directories user_0, user_1 etc. will be created automatically
     by OOo on startup in the ~/tmp folder of the running user.
-  TODO: use lock file (like /var/run/oood/pool.lock) for proper pool startup managment.
+
+  TODO: Merge start.py and runserw.py file in one file to manage oood. This
+        file should be called "ooodctl.py", ala zopectl.
 """
 
 
@@ -73,7 +75,7 @@
   _l("Listening at %s:%s" % (config.pool_host, instance_port), i, 0)
   pidfile = os.path.join(config.pid_dir, 'instance_%d.pid' % i)
   open(pidfile, 'w').write(str(pid))
-  _l("has pid %s" % pid, i, 0)
+  _l("Started as process  %s" % pid, i, 0)
 
 
 def killInstance(i):
@@ -93,7 +95,7 @@
       _l("Is still running and span on several processes: %s" % ', '.join([str(x) for x in instance_pid_list]), i, 0)
       # Kill all instance processes
       for pid in instance_pid_list:
-        _l("Killing pid %s" % pid, i, 1)
+        _l("Killing process %s..." % pid, i, 1)
         os.kill(pid, 9)
       _l("Killed", i, 0)
     else:
@@ -140,14 +142,14 @@
   """
     Show Pool details and statistics.
   """
-  # TODO: dynamic verbose message
+  # TODO: must be done (!)
   print "===== Pool Statistics ====="
-  print "Status: %s" % 'Started' #(stopped)
+  print "Status: %s" % "TODO"
   print "Size: %s" % config.pool_size
-  print "Uptime: %s" % 'unknown'
-  print "OOo instances running: %s" % config.pool_size
-  print "OOo instances stopped: %s" % 0
-  print "OOo instances automaticcaly restarted since launch: %s" % 0
+  print "Uptime: %s" % "TODO"
+  print "OOo instance running: %s" % "TODO"
+  print "OOo instance stopped: %s" % "TODO"
+  print "OOo instance auto-restarted since launch: %s" % "TODO"
 
 
 def usage():
@@ -164,23 +166,21 @@
 
 
 if __name__=='__main__':
-  # Get all parameters
+
+  # Parse options and parameters
   try:
     opts, args = getopt.getopt( sys.argv[1:]
                               , "hifsd"
                               , ["help", "init", "flush", "status", "stat"]
                               )
+    # Check args number
+    if len(opts) == 0:
+      raise getopt.GetoptError
   except getopt.GetoptError:
     # Print help information and exit on command line error
     usage()
     sys.exit(2)
 
-  # Check args number
-  if len(opts) == 0:
-    usage()
-    # Exit on command line error
-    sys.exit(2)
-
   # Start action according parameters
   for o, a in opts:
     if o in ("-h", "--help"):




More information about the Erp5-report mailing list