Mailing List Archives
	Authenticated access
	
	
     | 
    
	 
	 
     | 
    
	
	 
     | 
  
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[HTCondor-users] Trapping condor_hold in Python scripts on Windows
- Date: Fri, 07 Aug 2015 15:16:06 -0400
 
- From: Ben Cotton <ben.cotton@xxxxxxxxxxxxxxxxxx>
 
- Subject: [HTCondor-users] Trapping condor_hold in Python scripts on Windows
 
Has anyone had any luck trapping when a Python script is placed on
hold on Windows? My proof-of-concept script below works on Linux, but
not on Windows, despite the fact that the starterlog suggests that it
should:
08/07/15 14:53:10 (pid:7952) Got SIGTERM. Performing graceful shutdown.
import os
import signal
import sys
import time
def cleanShutdown(signal, frame):
    '''A method to handle shutdowns. This is necessary to prevent the agent from
    hanging on a HTCondor shutdown, since the shutdown script sends SIGQUIT
    instead of SIGTERM.'''
    print 'Received signal %i, shutting down server' % signal
    sys.exit(0)
# Capture SIGINT and SIGQUIT
signal.signal(signal.SIGINT,cleanShutdown)
signal.signal(signal.SIGTERM,cleanShutdown)
if os.name != 'nt':
    signal.signal(signal.SIGQUIT,cleanShutdown)
time.sleep(900)
-- 
Ben Cotton
main: 888.292.5320
Cycle Computing
Better Answers. Faster.
http://www.cyclecomputing.com
twitter: @cyclecomputing