Mirror selection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Mirror selection

"Martin v. Löwis"
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

http://www.dcl.hpi.uni-potsdam.de/home/loewis/_mirrorlib.py

The main function is

def find_mirror(start_with='a',
                  good_age = 30*60,
                  slow_mirrors_wait = 5,
                  prefer_fastest = True):
     '''find_mirrors(start_with, good_age, slow_mirrors_wait,
prefer_fastest)
        -> [(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'''

Regards,
Martin
_______________________________________________
Catalog-SIG mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/catalog-sig