Changeset 1443
- Timestamp:
- 04/21/04 10:36:32 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/tool.py
r1439 r1443 22 22 # 23 23 # $Log$ 24 # Revision 1.84 2004/04/21 08:36:32 jalet 25 # Exports the PYKOTASTATUS environment variable when SIGTERM is received. 26 # 24 27 # Revision 1.83 2004/04/16 17:03:49 jalet 25 28 # The list of printers groups the current printer is a member of is … … 765 768 signal.signal(signal.SIGTERM, self.sigterm_handler) 766 769 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] = name770 771 def unregisterChild(self, pid) :772 try :773 del self.childProcesses[pid]774 except KeyError :775 pass776 777 770 def sigterm_handler(self, signum, frame) : 778 771 """Sets a global variable whenever SIGTERM is received.""" 779 # SIGTERM will be ignore most of the time, but during780 # the call to the real backend, we have to pass it through.781 772 self.gotSigTerm = 1 773 os.putenv("PYKOTASTATUS", "CANCELLED") 782 774 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 pass788 else :789 self.logdebug("SIGTERM sent to process %s (%s)." % (childpid, childname))790 775 791 776 def exportJobInfo(self) :