You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by aj...@apache.org on 2005/04/26 16:04:36 UTC
svn commit: r164789 - /gump/trunk/python/gump/util/process/launcher.py
Author: ajack
Date: Tue Apr 26 07:04:35 2005
New Revision: 164789
URL: http://svn.apache.org/viewcvs?rev=164789&view=rev
Log:
1) Attempt to avoid suicide.
2) Log more about PIDs/ProcessGroup IDs just in case we didn't fix (1)
Modified:
gump/trunk/python/gump/util/process/launcher.py
Modified: gump/trunk/python/gump/util/process/launcher.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/util/process/launcher.py?rev=164789&r1=164788&r2=164789&view=diff
==============================================================================
--- gump/trunk/python/gump/util/process/launcher.py (original)
+++ gump/trunk/python/gump/util/process/launcher.py Tue Apr 26 07:04:35 2005
@@ -92,7 +92,7 @@
# Child gets PID = 0
if 0 == forkPID:
# Run the information within this file...
- os._exit(runProcess(execFile))
+ os._exit(runProcess(execFile,0))
# Parent gets real PID
else:
@@ -195,9 +195,11 @@
"""
Kill this (and all child processes).
"""
- log.warn('Kill process group (anything launched by PID' + str(pid) + ')')
+ log.warn('Kill process group (anything launched by PID %s)' % (pid))
try:
pgrpID=os.getpgid(pid)
+ log.warn('Kill process group %s (anything launched by PID %s) [from %s]' \
+ % (pgrpID, pid, os.getpid()))
if -1 != pgrpID:
os.killpg(pgrpID,signal.SIGKILL)
else:
@@ -210,15 +212,15 @@
"""
Kill this (and all child processes).
"""
- gumpid = default.gumpid
- log.warn('Kill all child processed (anything launched by PID' + str(gumpid) + ')')
+ pid=os.getpid()
+ log.warn('Kill all child processed (anything launched by PID %s)' % (pid))
try:
- os.kill(gumpid,signal.SIGKILL)
+ os.kill(pid,signal.SIGKILL)
gumpid
except Exception, details:
log.error('Failed to dispatch signal ' + str(details), exc_info=1)
-def runProcess(execFilename):
+def runProcess(execFilename,standaloneProcess=1):
"""
Read an 'exec file' (formatted by Gump) to detect what to run,
and how to run it.
@@ -258,7 +260,7 @@
# Timeout support
timer = None
- if timeout:
+ if timeout and standaloneProcess:
import threading
timer = threading.Timer(timeout, shutdownProcesses)
timer.setDaemon(1)
@@ -296,7 +298,7 @@
execFilename = sys.argv[1]
# Run the information within this file...
- exit_code = runProcess(execFilename)
+ exit_code = runProcess(execFilename,1)
# print 'Exit: ' + `exit_code`
sys.exit(exit_code)