[Erp5-report] r11426 - /erp5/trunk/utils/oood/pool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Nov 22 12:18:26 CET 2006
Author: kevin
Date: Wed Nov 22 12:18:24 2006
New Revision: 11426
URL: http://svn.erp5.org?rev=11426&view=rev
Log:
Use generic kill method to restart an instance.
Change some code to respect coding conventions.
Modified:
erp5/trunk/utils/oood/pool.py
Modified: erp5/trunk/utils/oood/pool.py
URL: http://svn.erp5.org/erp5/trunk/utils/oood/pool.py?rev=11426&r1=11425&r2=11426&view=diff
==============================================================================
--- erp5/trunk/utils/oood/pool.py (original)
+++ erp5/trunk/utils/oood/pool.py Wed Nov 22 12:18:24 2006
@@ -78,7 +78,7 @@
self.timers[idx].start()
return idx,w
- def rebuild(self,i):
+ def rebuild(self, i):
'''
triggered by a timer thread in case worker takes too long
rebuilds the worker instance
@@ -94,14 +94,9 @@
So, we hack - we do "ps" to find parent process and explicitly kill both
it is not very portable, but I don't have a better idea...
"""
- print 'that takes too long!'
- pidfile=os.path.join(config.pid_dir, 'instance_%d.pid' % i)
- pid=int(open(pidfile).read())
- lib.log('instance '+str(i)+' not responding - restarting '+str(pid),3)
- pids=os.popen('ps -A -o pid,ppid | grep %d | cut -f 1 -d " "' % pid)
- for p in pids:
- lib.log('killing pid '+p.strip(),3)
- os.kill(int(p),9)
+ print 'That takes too long !'
+ lib.log('Instance %s not responding - restart it' % i, 3)
+ start.killInstance(i)
start.startInstance(i)
# give it time to load before we try to connect
time.sleep(config.instance_load_time)
@@ -109,9 +104,9 @@
self.release(i)
return _rebuild
- def _mkWorker(self,i):
- self.inst[i]=(factory.builder.build(self,i))
+ def _mkWorker(self, i):
+ self.inst[i] = (factory.builder.build(self, i))
-pool=Pool()
+pool = Pool()
# vim: shiftwidth=2
More information about the Erp5-report
mailing list