Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View test.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import multiprocessing
import time
 
def mytask(num):
print('Started task, sleeping %s' % num)
time.sleep(num)
 
pool = multiprocessing.Pool(4)
jobs = pool.map_async(mytask, [1,2,3,4,5,3,2,3,4,5,2,3,2,3,4,5,6,4], chunksize=1)
pool.close()
 
while True:
if not jobs.ready():
print('We\'re not done yet, %s tasks to go!' % jobs._number_left)
time.sleep(1)
else:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.