#NEWLINE# def run( self ) : #NEWLINE# #INDENT# images = self . cache . get_queued_images ( ) #NEWLINE# if ( not images ) : #NEWLINE# #INDENT# logger . debug ( _ ( 'Nothing to prefetch.' ) ) #NEWLINE# return True #NEWLINE# #UNINDENT# num_images = len ( images ) #NEWLINE# logger . debug ( _ ( 'Found %d images to prefetch' ) , num_images ) #NEWLINE# pool = eventlet . GreenPool ( num_images ) #NEWLINE# results = pool . imap ( self . fetch_image_into_cache , images ) #NEWLINE# successes = sum ( [ 1 for r in results if ( r is True ) ] ) #NEWLINE# if ( successes != num_images ) : #NEWLINE# #INDENT# logger . error ( _ ( 'Failed to successfully cache all images in queue.' ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# logger . info ( _ ( 'Successfully cached all %d images' ) , num_images ) #NEWLINE# return True