Show
Ignore:
Timestamp:
04/10/04 00:24:47 (20 years ago)
Author:
jalet
Message:

Began work on correct handling of child processes when jobs are cancelled by
the user. Especially important when an external requester is running for a
long time.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r1426 r1433  
    2222# 
    2323# $Log$ 
     24# Revision 1.81  2004/04/09 22:24:47  jalet 
     25# Began work on correct handling of child processes when jobs are cancelled by 
     26# the user. Especially important when an external requester is running for a 
     27# long time. 
     28# 
    2429# Revision 1.80  2004/04/06 12:00:21  jalet 
    2530# uninitialized values caused problems 
     
    741746        self.exportJobInfo() 
    742747         
     748        # then deal with signals 
     749        # CUPS backends ignore SIGPIPE and exit(1) on SIGTERM 
     750        # Fortunately SIGPIPE is already ignored by Python 
     751        # It's there just in case this changes in the future. 
     752        # Here we have to handle SIGTERM correctly, and pass 
     753        # it to any child if needed. 
     754        self.gotSigTerm = 0 
     755        signal.signal(signal.SIGPIPE, signal.SIG_IGN) 
     756        signal.signal(signal.SIGTERM, self.sigterm_handler) 
     757         
     758    def sigterm_handler(self, signum, frame) : 
     759        """Sets a global variable whenever SIGTERM is received.""" 
     760        # SIGTERM will be ignore most of the time, but during 
     761        # the call to the real backend, we have to pass it through. 
     762        self.gotSigTerm = 1 
     763        self.logger.log_message(_("SIGTERM received, job %s cancelled.") % self.jobid, "info") 
     764         
    743765    def exportJobInfo(self) :     
    744766        """Exports job information to the environment."""