Skip to content

Instantly share code, notes, and snippets.

@eka

eka/test.py Secret

Created January 24, 2015 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eka/9db2854283eb86cb0ba0 to your computer and use it in GitHub Desktop.
Save eka/9db2854283eb86cb0ba0 to your computer and use it in GitHub Desktop.
import multiprocessing
import sys
def foo(value):
print "sleeping for %s secs" % value
sleep(value)
values = range(10)
pool = multiprocessing.Pool(processes=int(sys.argv[1]))
pool.map_async(foo, values)
pool.close()
pool.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment