I run a multipocessing script like this:
def intersterer(i):
somestuff
return x
if __name__ == '__main__':
pool = Pool()
list = pool.map(intersterer, itertools.combinations(xrange(great_number), 2))
I want know how I can see the progress of the work. I look around a shared counter, but its ugly and seems not telling the truth. (Perhaps a wrong code in it) Can someone help me with a great pythonic way?
EDIT: Like my exemple, I want to store all results in a list, answers at the question : Show the progress of a Python multiprocessing pool map call? doesn't help me for this. Thks
EDIT2:
Here is the soluced way. Thks every helpers!
def intersterer(i):
somestuff
return x
numtot = binomial(number,2)
pool = Pool()
list=[]
tpsb=time.time()
for i in pool.imap_unordered(intersterer, itertools.combinations(xrange(number),2)):
list.append(i); print "{:3.2f}%, approximatly {:3.2f} seconds left \r".format(100.*len(list)/numtot, (time.time()-tpsb)*100./(100.*len(list)/numtot)-(time.time()-tpsb)),