Created
October 4, 2015 18:20
-
-
Save poros/9afff244461b55b29883 to your computer and use it in GitHub Desktop.
Process/thread pool for embarrassingly parallel problems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Pool | |
pool = Pool(4) | |
results = pool.map(urllib2.urlopen, urls) | |
pool.close() | |
pool.join() | |
# if you want threads instead of processes | |
from multiprocessing.dummy import Pool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment