#NEWLINE# def get_available_urls( self , urls ) : #NEWLINE# #INDENT# 'Return reachable urls sorted by their ping times.' #NEWLINE# netloc_to_url = { urlparse . urlparse ( url ) . netloc : url for url in urls } #NEWLINE# pingtimes = self . _pinger . pings ( netloc_to_url . keys ( ) ) #NEWLINE# self . _log . debug ( 'Artifact cache server ping times: {}' . format ( ', ' . join ( [ '{}: {:.6f} secs' . format ( * p ) for p in pingtimes ] ) ) ) #NEWLINE# sorted_pingtimes = sorted ( pingtimes , key = ( lambda x : x [ 1 ] ) ) #NEWLINE# available_urls = [ netloc_to_url [ netloc ] for ( netloc , pingtime ) in sorted_pingtimes if ( pingtime < Pinger . UNREACHABLE ) ] #NEWLINE# self . _log . debug ( 'Available cache servers: {0}' . format ( available_urls ) ) #NEWLINE# return urls