#NEWLINE# def _get_estimates( self , resource_desc , need_hostnames = False ) : #NEWLINE# #INDENT# ' Return best (estimate, criteria, allocator). ' #NEWLINE# best_estimate = ( - 2 ) #NEWLINE# best_criteria = None #NEWLINE# best_allocator = None #NEWLINE# for allocator in self . _allocators : #NEWLINE# #INDENT# ( estimate , criteria ) = allocator . time_estimate ( resource_desc ) #NEWLINE# if ( estimate == ( - 2 ) ) : #NEWLINE# #INDENT# key = criteria . keys ( ) [ 0 ] #NEWLINE# info = criteria [ key ] #NEWLINE# self . _logger . debug ( '%r incompatible: key %r: %s' , allocator . name , key , info ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = ( 'OK' if ( criteria == 0 ) else ( 'returned %g' % estimate ) ) #NEWLINE# self . _logger . debug ( '%r %s' , allocator . name , msg ) #NEWLINE# #UNINDENT# if ( ( ( best_estimate == ( - 2 ) ) and ( estimate >= ( - 1 ) ) ) or ( ( best_estimate == 0 ) and ( estimate > 0 ) ) or ( ( best_estimate > 0 ) and ( estimate < best_estimate ) ) ) : #NEWLINE# #INDENT# if ( ( estimate >= 0 ) and need_hostnames and ( not ( 'hostnames' in criteria ) ) ) : #NEWLINE# #INDENT# self . _logger . debug ( "%r is missing 'hostnames'" , allocator . name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# best_estimate = estimate #NEWLINE# best_criteria = criteria #NEWLINE# best_allocator = allocator #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( best_estimate , best_criteria , best_allocator )