#NEWLINE# def run_job( self , name ) : #NEWLINE# #INDENT# '\n        Run a schedule job now\n        ' #NEWLINE# schedule = self . opts [ 'schedule' ] #NEWLINE# if ( 'schedule' in self . opts [ 'pillar' ] ) : #NEWLINE# #INDENT# schedule . update ( self . opts [ 'pillar' ] [ 'schedule' ] ) #NEWLINE# #UNINDENT# data = schedule [ name ] #NEWLINE# if ( 'function' in data ) : #NEWLINE# #INDENT# func = data [ 'function' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'func' in data ) : #NEWLINE# #INDENT# func = data [ 'func' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'fun' in data ) : #NEWLINE# #INDENT# func = data [ 'fun' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# func = None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( func not in self . functions ) : #NEWLINE# #INDENT# log . info ( 'Invalid function: {0} in scheduled job {1}.' . format ( data , name ) ) #NEWLINE# #UNINDENT# if ( 'name' not in data ) : #NEWLINE# #INDENT# data [ 'name' ] = name #NEWLINE# #UNINDENT# log . info ( 'Running Job: {0}.' . format ( name ) ) #NEWLINE# multiprocessing_enabled = self . opts . get ( 'multiprocessing' , True ) #NEWLINE# if multiprocessing_enabled : #NEWLINE# #INDENT# thread_cls = SignalHandlingMultiprocessingProcess #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# thread_cls = threading . Thread #NEWLINE# #UNINDENT# proc = thread_cls ( target = self . handle_func , args = ( multiprocessing_enabled , func , data ) ) #NEWLINE# if multiprocessing_enabled : #NEWLINE# #INDENT# with default_signals ( signal . SIGINT , signal . SIGTERM ) : #NEWLINE# #INDENT# proc . start ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# proc . start ( ) #NEWLINE# #UNINDENT# if multiprocessing_enabled : #NEWLINE# #INDENT# proc . join ( )