Skip to content

Instantly share code, notes, and snippets.

@georgefs
Created December 4, 2013 04:00
Show Gist options
  • Save georgefs/7782145 to your computer and use it in GitHub Desktop.
Save georgefs/7782145 to your computer and use it in GitHub Desktop.
python simple multi process demo
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