def get_available_urls(self, urls):

    netloc_to_url = {urlparse.urlparse(url).netloc: url for url in urls}
    pingtimes = self._pinger.pings(netloc_to_url.keys())  # List of pairs (host, time in ms).
    self._log.debug('Artifact cache server ping times: {}'
                    .format(', '.join(['{}: {:.6f} secs'.format(*p) for p in pingtimes])))

    sorted_pingtimes = sorted(pingtimes, key=lambda x: x[1])
    available_urls = [netloc_to_url[netloc] for netloc, pingtime in sorted_pingtimes
                      if pingtime < Pinger.UNREACHABLE]
    self._log.debug('Available cache servers: {0}'.format(available_urls))

    return available_urls
Return reachable urls sorted by their ping times.
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/cache/cache_setup.py/CacheFactory.get_available_urls