예제 #1
0
#
# check loop
#
for i in range(0, count):
    name = names[i * 2][0]
    print "Run test: " + names[i * 2][0]

    f1 = INPUT_PATH + names[i * 2][2]
    qlink_urls = shufle_urls_from_file(f1)
    f2 = INPUT_PATH + names[i * 2 + 1][2]
    unk_urls = shufle_urls_from_file(f2)

    t1 = time.time()
    # define segments here
    sekitei_segments.define_segments(qlink_urls[:curl_for_segments],
                                     unk_urls[:curl_for_segments], MAX_QUOTA)
    qlink_urls = [(1, url) for url in qlink_urls[curl_for_segments:]]
    unk_urls = [(0, url) for url in unk_urls[curl_for_segments:]]

    urls_mix = []
    urls_mix.extend(qlink_urls)
    urls_mix.extend(unk_urls)
    random.shuffle(urls_mix)

    urls_fetched = 0
    qlinks_fetched = 0
    qlinks_count = len(qlink_urls)

    for url in urls_mix:
        if sekitei_segments.fetch_url(url[1]):
            urls_fetched += 1
예제 #2
0
# check loop
#
for i in range(0, count):
    name = names[i*2][0]
    print "Run test: " + names[i*2][0]
    
    
    f1 = INPUT_PATH + names[i*2][2]
    qlink_urls = shufle_urls_from_file(f1);    
    f2 = INPUT_PATH + names[i*2+1][2]
    unk_urls = shufle_urls_from_file(f2);
            
    t1 = time.time() 
    # define segments here
    sekitei_segments.define_segments(qlink_urls[:curl_for_segments], 
                                     unk_urls[:curl_for_segments],
                                     MAX_QUOTA);
    qlink_urls = [(1, url) for url in qlink_urls[curl_for_segments:]];
    unk_urls = [(0, url) for url in unk_urls[curl_for_segments:] ];
    
    urls_mix = []
    urls_mix.extend(qlink_urls);
    urls_mix.extend(unk_urls);
    random.shuffle(urls_mix)
    
    urls_fetched = 0;
    qlinks_fetched = 0    
    qlinks_count = len(qlink_urls);
    
    for url in urls_mix:
        if sekitei_segments.fetch_url(url[1]) :