def process_results(results):
    """ process the results and gather data """

    conn = get_connection()
    new_results = []
    for d in results:
        mirror = d.get('mirror')
        if mirror in IGNORE_MIRRORS:
            # skip mirrors we want to ignore.
            continue
        status = d.get('status')
        location = get_location_for_mirror(mirror)
        d['location'] = location_name(location)
        if status != 'Unavailable':
            resp_time = d.get('response_time')
            age = get_total_seconds(d.get('time_diff'))
            conn.rpush(cache_key('RESPTIME', mirror), resp_time)
            conn.rpush(cache_key('AGE', mirror), age)
            resp_list = conn.lrange(cache_key('RESPTIME', mirror), -60, -1)
            age_list = conn.lrange(cache_key('AGE', mirror), -60, -1)
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #2
0
def process_results(results):
    """ process the results and gather data """

    conn = get_connection()
    new_results = []
    for d in results:
        mirror = d.get('mirror')
        if mirror in IGNORE_MIRRORS:
            # skip mirrors we want to ignore.
            continue
        status = d.get('status')
        location = get_location_for_mirror(mirror)
        d['location'] = location_name(location)
        if  status != 'Unavailable':
            resp_time = d.get('response_time')
            age = get_total_seconds(d.get('time_diff'))
            conn.rpush(cache_key('RESPTIME', mirror), resp_time )
            conn.rpush(cache_key('AGE', mirror), age)
            resp_list = conn.lrange(cache_key('RESPTIME', mirror), -60, -1)
            age_list = conn.lrange(cache_key('AGE', mirror), -60, -1)
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #3
0
def process_results(results):
    """ process the results and gather data """

    new_results = []
    for d in results:
        mirror = d.get('mirror')
        status = d.get('status')
        d['location'] = "n/a"
        if  status != 'Unavailable':
            resp_list = ["1","2","3","4","5","6","7","8","9","10"] # faked out for test
            age_list = ["1","2","3","4","5","6","7","8","9","10"] # faked out for test
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #4
0
def process_results(results):
    """ process the results and gather data """

    new_results = []
    for d in results:
        mirror = d.get('mirror')
        status = d.get('status')
        d['location'] = "n/a"
        if status != 'Unavailable':
            resp_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9",
                         "10"]  # faked out for test
            age_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9",
                        "10"]  # faked out for test
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #5
0
def process_results(results):
    """ process the results and gather data """

    new_results = []
    for d in results:
        mirror = d.get("mirror")
        if mirror in IGNORE_MIRRORS:
            # skip mirrors we want to ignore.
            continue
        status = d.get("status")
        d["location"] = "n/a"
        if status != "Unavailable":
            resp_time = d.get("response_time")
            age = get_total_seconds(d.get("time_diff"))
            resp_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]  # faked out for test
            age_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]  # faked out for test
            d["num_packages"] = find_number_of_packages(mirror)
            d["resp_list"] = ",".join(resp_list)
            d["age_list"] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #6
0
def process_results(results):
    """ process the results and gather data """

    new_results = []
    for d in results:
        mirror = d.get('mirror')
        if mirror in IGNORE_MIRRORS:
            # skip mirrors we want to ignore.
            continue
        status = d.get('status')
        d['location'] = "n/a"
        if status != 'Unavailable':
            resp_time = d.get('response_time')
            age = get_total_seconds(d.get('time_diff'))
            resp_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9",
                         "10"]  # faked out for test
            age_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9",
                        "10"]  # faked out for test
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results