You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by aj...@apache.org on 2003/10/20 18:37:17 UTC
cvs commit: jakarta-gump/python/gump model.py launcher.py
ajack 2003/10/20 09:37:17
Modified: python/gump model.py launcher.py
Log:
Replace alarm signal (not working) with Timer (Thread) class, which seems portable.
pkill is still *nix only.
Revision Changes Path
1.36 +6 -6 jakarta-gump/python/gump/model.py
Index: model.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- model.py 20 Oct 2003 14:20:09 -0000 1.35
+++ model.py 20 Oct 2003 16:37:17 -0000 1.36
@@ -404,10 +404,10 @@
property['reference']='jarpath'
# Name the property...
- name=depend.property
- if name:
+ if depend.property:
property['name']=depend.property
- else:
+ elif not hasattr(property,'name'):
+ # :TODO: Reconsider later, but default to project name for now...
property['name']=depend.project
log.warn('Unnamed property in depend for: ' + depend.project + ' on ' + project.name)
1.24 +10 -14 jakarta-gump/python/gump/launcher.py
Index: launcher.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/launcher.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- launcher.py 20 Oct 2003 14:20:10 -0000 1.23
+++ launcher.py 20 Oct 2003 16:37:17 -0000 1.24
@@ -66,6 +66,8 @@
import sys
import logging
import signal
+
+from threading import Timer
from string import split
@@ -286,14 +288,7 @@
log.warn('Kill all child processed (anything launched by Gumpy) [PID' + str(pid) + ']')
command='pkill -KILL -P ' + str(pid)
exitcode=os.system(command)
- log.warn('Command: [' + command + '] exited with [' + str(exitcode) + ']')
-
-#
-# Kill the children
-#
-def timeoutHandler(signum, frame):
- log.info('Timeout Handler Called [Signal : ' + str(signum) + ']')
- killChildProcesses()
+ log.warn('Command: [' + command + '] exited with [' + str(exitcode) + ']')
def execute(cmd,tmp=dir.tmp):
res=CmdResult(cmd)
@@ -363,16 +358,17 @@
log.info('Executing: ' + execString + ' (Output to ' + str(outputFile) + ')')
# Set the signal handler and an N-second alarm
- if not os.name == 'dos' and not os.name == 'nt':
- signal.signal(signal.SIGALRM, timeoutHandler)
- timeout=cmd.timeout or setting.timeout
- signal.alarm(timeout)
+ timeout=cmd.timeout or setting.timeout
+ timer = Timer(timeout, killChildProcesses)
+ timer.start()
# Execute Command & Wait
result.exit_code=os.system(execString + ' >>' + str(outputFile) + ' 2>&1')
+
+ log.info('Executed. ExitCode: ' + str(result.exit_code))
- if not os.name == 'dos' and not os.name == 'nt':
- signal.alarm(0) # Disable the alarm
+ # Stop it (if still running)
+ timer.cancel()
# Process Outputs (exit_code and stderr/stdout)
if result.exit_code < 0: