#NEWLINE# def _run_command( zk_path , command , max_wait_in_secs , watch_type , value = None , stat = None ) : #NEWLINE# #INDENT# ' Invoking the shell command\n    ' #NEWLINE# log . debug ( ( "Invoking command '%s'" % command ) ) #NEWLINE# global _PATH_TO_DATA #NEWLINE# data = _PATH_TO_DATA . get ( zk_path , None ) #NEWLINE# if ( data and stat and ( data . get ( 'version' , ( - 1 ) ) >= stat . version ) ) : #NEWLINE# #INDENT# log . info ( ( 'Version %d is not newer than the current version %d, ignore' % ( stat . version , data [ 'version' ] ) ) ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if stat : #NEWLINE# #INDENT# version = stat . version #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# version = None #NEWLINE# #UNINDENT# notification_timestamp = time . time ( ) #NEWLINE# log . info ( ( "Notification is queued for running command '%s' with version %s and event timestamp %f" % ( command , str ( version ) , notification_timestamp ) ) ) #NEWLINE# _NOTIFICATION_EVENT_QUEUE . put ( ( zk_path , command , value , version , max_wait_in_secs , watch_type , notification_timestamp ) )