Created
December 4, 2013 04:00
-
-
Save georgefs/7782145 to your computer and use it in GitHub Desktop.
python simple multi process demo
This file contains 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 | |
def fun(x): | |
print x | |
if __name__ == '__main__': | |
pool = Pool(processes=5) | |
with open('log', 'r+') as f: | |
for line in f: | |
pool.apply_async(fun, [line]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment