-
Notifications
You must be signed in to change notification settings - Fork 0
/
threadmain.py
65 lines (52 loc) · 1.83 KB
/
threadmain.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import revhelper
import os.path
import urllib
import imgchar
import traf
import revs
import shutil
import threading
import time
starttime = time.time()
infile = open("listu_part.csv")
names = []
for line in infile:
names.append(line.strip())
def worker(playername, month, year):
"""thread worker function"""
print 'Worker: %s' % playername + " at " + str(time.clock())
revhelper.updaterevlookup(playername, month, year)
return
threads = []
count = 0
for name in names:
count = count + 1
for month in range(14,13):
for year in range(2006,2012):
# for each combination get revid information and update lookup
playername = urllib.quote(name)
print "Processing " + playername + ":" + str(month) +"," + str(year)
t = threading.Thread(target=worker, args=(playername,month, year,))
threads.append(t)
t.start()
print
if count % 5 == 0:
print "waiting for threads \n"
for thread in threading.enumerate():
if thread is not threading.currentThread():
thread.join()
print "HOLDUP : Here come all the big files"
revhelper.getrevfiles(40000)
# for name in names:
# for month in range(12,13):
# for year in range(2006,2012):
# # for each combination get revid information and update lookup
# playername = urllib.quote(name)
# print "Getting " + playername + ":" + str(month) +"," + str(year)
# t = threading.Thread(target=worker, args=(playername,month, year,))
# threads.append(t)
# t.start()
# imgchar.updateimgcharlookup(playername,month,year)
# traf.updatetraflookup(playername, month, year)
# revs.updaterevslookup(playername, month, year)
print "elapsed time " + str(time.time() - starttime)