#NEWLINE# def get_event_iter_returns( self , jid , minions , timeout = None ) : #NEWLINE# #INDENT# '\n        Gather the return data from the event system, break hard when timeout\n        is reached.\n        ' #NEWLINE# log . trace ( 'entered - function get_event_iter_returns()' ) #NEWLINE# if ( timeout is None ) : #NEWLINE# #INDENT# timeout = self . opts [ 'timeout' ] #NEWLINE# #UNINDENT# timeout_at = ( time . time ( ) + timeout ) #NEWLINE# found = set ( ) #NEWLINE# if ( self . returners [ '{0}.get_load' . format ( self . opts [ 'master_job_cache' ] ) ] ( jid ) == { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# log . warning ( 'jid does not exist' ) #NEWLINE# ( yield { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# raise StopIteration ( ) #NEWLINE# #UNINDENT# while True : #NEWLINE# #INDENT# raw = self . event . get_event ( ret ) #NEWLINE# if ( ( raw is None ) or ( time . time ( ) > timeout_at ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if ( 'minions' in raw . get ( 'data' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# found . add ( raw [ 'id' ] ) #NEWLINE# ret = { #NEWLINE# #INDENT# raw [ 'id' ] : { #NEWLINE# #INDENT# 'ret' : raw [ 'return' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( 'out' in raw ) : #NEWLINE# #INDENT# ret [ raw [ 'id' ] ] [ 'out' ] = raw [ 'out' ] #NEWLINE# #UNINDENT# ( yield ret ) #NEWLINE# time . sleep ( 0.02 )