[Catalog-sig] Mirror selection
"Martin v. Löwis"
martin at v.loewis.de
Tue Mar 13 21:17:32 CET 2012
We were just talking about PyPI mirror selection at the sprint,
so people asked me to release the current implementation of my
mirror selection algorithm, which is now at
The main function is
good_age = 30*60,
slow_mirrors_wait = 5,
prefer_fastest = True):
'''find_mirrors(start_with, good_age, slow_mirrors_wait,
-> [(name, family, IP, response_time, last_modified)]
Find a PyPI mirror matching given criteria.
start_with indicates the first mirror that should be considered
(defaults to 'a').
If prefer_fastest is True, it stops with the first mirror
responding. Mirrors 'compete'
against each other in randomly-shuffled batches of 10.
If this procedure goes on for longer than slow_mirrors_wait
(default 5s) and prefer_fastest
is false, return even if not all mirrors have been responding.
If no matching mirror can be found, the newest one that did
response is returned.
If no mirror can be found at all, ValueError is raised'''
More information about the Catalog-SIG