Changeset 1443

Show
Ignore:
Timestamp:
04/21/04 10:36:32 (21 years ago)
Author:
jalet
Message:

Exports the PYKOTASTATUS environment variable when SIGTERM is received.

Files:
1 modified

Legend:

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

    r1439 r1443  
    2222# 
    2323# $Log$ 
     24# Revision 1.84  2004/04/21 08:36:32  jalet 
     25# Exports the PYKOTASTATUS environment variable when SIGTERM is received. 
     26# 
    2427# Revision 1.83  2004/04/16 17:03:49  jalet 
    2528# The list of printers groups the current printer is a member of is 
     
    765768        signal.signal(signal.SIGTERM, self.sigterm_handler) 
    766769         
    767     def registerChild(self, pid, name) :     
    768         """Registers a child process so that we will be able to kill it later if needed.""" 
    769         self.childProcesses[pid] = name 
    770          
    771     def unregisterChild(self, pid) :     
    772         try : 
    773             del self.childProcesses[pid] 
    774         except KeyError :     
    775             pass 
    776              
    777770    def sigterm_handler(self, signum, frame) : 
    778771        """Sets a global variable whenever SIGTERM is received.""" 
    779         # SIGTERM will be ignore most of the time, but during 
    780         # the call to the real backend, we have to pass it through. 
    781772        self.gotSigTerm = 1 
     773        os.putenv("PYKOTASTATUS", "CANCELLED") 
    782774        self.logger.log_message(_("SIGTERM received, job %s cancelled.") % self.jobid, "info") 
    783         for (childpid, childname) in self.childProcesses.items() : 
    784             try : 
    785                 os.kill(childpid, signal.SIGTERM) 
    786             except :     
    787                 pass 
    788             else :     
    789                 self.logdebug("SIGTERM sent to process %s (%s)." % (childpid, childname)) 
    790775         
    791776    def exportJobInfo(self) :