#NEWLINE# def stop( self , force = False ) : #NEWLINE# #INDENT# '\n        Stop this program\n        ' #NEWLINE# if ( not self . is_running ) : #NEWLINE# #INDENT# raise errors . StateError ( 'Program is not running' ) #NEWLINE# #UNINDENT# if force : #NEWLINE# #INDENT# if self . state . get ( 'pid' ) : #NEWLINE# #INDENT# log . debug ( ( 'Force killing chalmers monitor process pid=%s' % self . state . get ( 'pid' ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# kill_tree ( self . state . get ( 'pid' ) ) #NEWLINE# #UNINDENT# except psutil . NoSuchProcess : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if self . state . get ( 'child_pid' ) : #NEWLINE# #INDENT# log . debug ( ( 'Force killing chalmers child process pid=%s' % self . state . get ( 'child_pid' ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# kill_tree ( self . state . get ( 'child_pid' ) ) #NEWLINE# #UNINDENT# except psutil . NoSuchProcess : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# send_action ( self . name , 'terminate' , timeout = self . data [ 'stopwaitsecs' ] )