[Erp5-report] r11443 - /erp5/trunk/utils/oood/start.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Nov 22 17:30:11 CET 2006
Author: kevin
Date: Wed Nov 22 17:30:09 2006
New Revision: 11443
URL: http://svn.erp5.org?rev=11443&view=rev
Log:
Update messages
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=11443&r1=11442&r2=11443&view=diff
==============================================================================
--- erp5/trunk/utils/oood/start.py (original)
+++ erp5/trunk/utils/oood/start.py Wed Nov 22 17:30:09 2006
@@ -35,6 +35,7 @@
import getopt, time, glob # Standard python libs
import lib, config # ood python libs
+
"""
Starts OOo instances to populate the pool.
@@ -79,7 +80,6 @@
_l("Kill requested", i, 1)
pid_file_path = os.path.join(config.pid_dir, 'instance_%s.pid' % i)
if os.path.exists(pid_file_path):
- _l("Is still running or was not properly shutdown: Kill it", i, 0)
pid_file = open(pid_file_path, 'r')
instance_master_pid = int(pid_file.read())
pid_file.close()
@@ -90,18 +90,24 @@
if pid.find('%s' % instance_master_pid) != -1:
instance_pid_list.append(int(pid.strip().split(' ')[0]))
if len(instance_pid_list) > 0:
- _l("Span on several processes: %s" % ', '.join([str(x) for x in instance_pid_list]), i, 0)
+ _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)
os.kill(pid, 9)
+ _l("Killed", i, 0)
+ else:
+ _l("Was not properly shutdown", i, 0)
os.remove(pid_file_path)
- _l("Killed", i, 0)
+ _l("Cleaned", i, 0)
else:
- _l("Was not running or didn't exist, so no need to kill", i, 0)
+ _l("Didn't exist, so no need to kill", i, 0)
def initPool():
+ """
+ This mehod initialize the pool: it kill all previous OOo instances (if any) and re-populate the pool.
+ """
lib.log("Pool - Initialize: populate the pool with %s instances" % config.pool_size, 0)
flushPool()
for i in range(config.pool_size):
@@ -112,6 +118,9 @@
def flushPool():
+ """
+ This method flush the pool: it kill all OOo instances to empty the pool.
+ """
lib.log("Pool - Flush requested: kill all instances", 1)
# pool_size can change dynamiccaly, so clear every running OOo intance
max_pool_size = config.pool_size
@@ -142,22 +151,25 @@
def usage():
- print """Usage: %s [options]
- -i, --init
- Initialize the pool: kill all previous OOo instances (if any) and re-populate the pool.
- -f, --flush
- Flush the pool: kill all OOo instances to empty the pool.
- -s, --status, --stat
- Show pool statistics and status.
- -h, --help
- Show this screen.
+ print """Usage: %s [options]
+ -i, --init
+ Initialize the pool: kill all previous OOo instances (if any) and re-populate the pool.
+ -f, --flush
+ Flush the pool: kill all OOo instances to empty the pool.
+ -s, --status, --stat
+ Show pool statistics and status.
+ -h, --help
+ Show this screen.
""" % sys.argv[0]
if __name__=='__main__':
# Get all parameters
try:
- opts, args = getopt.getopt(sys.argv[1:], "hifs", ["help", "init", "flush", "status", "stat"])
+ opts, args = getopt.getopt( sys.argv[1:]
+ , "hifsd"
+ , ["help", "init", "flush", "status", "stat"]
+ )
except getopt.GetoptError:
# Print help information and exit on command line error
usage()
More information about the Erp5-report
mailing list