#NEWLINE# def _cancel( self , name ) : #NEWLINE# #INDENT# 'Wrapper function to kill a subprocess.' #NEWLINE# if ( name not in self . tasks ) : #NEWLINE# #INDENT# log . info ( ( 'TASK: Tried cancelling task %s, but task not found.' % str ( name ) ) ) #NEWLINE# return True #NEWLINE# #UNINDENT# task_process = self . tasks [ name ] #NEWLINE# log . info ( ( 'TASK: Cancelling task %s' % str ( task_process ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# os . killpg ( task_process . pid , signal . SIGKILL ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# with self . lock : #NEWLINE# #INDENT# if ( name in self . tasks ) : #NEWLINE# #INDENT# del self . tasks [ name ] #NEWLINE# #UNINDENT# #UNINDENT# return True