Skip to content

Instantly share code, notes, and snippets.

@jovianlin
Created November 16, 2016 02:23
Show Gist options
  • Save jovianlin/1ad5544f3c8c3283124a7112667e9d74 to your computer and use it in GitHub Desktop.
Save jovianlin/1ad5544f3c8c3283124a7112667e9d74 to your computer and use it in GitHub Desktop.
Test Multiprocessing Pool
from multiprocessing import Pool
def job(x):
return x ** 2
# End of job(...).
if __name__ == "__main__":
p = Pool(processes=50)
data_1 = p.map(job, range(10))
data_2 = p.map(job, [99, 111, 7236])
p.close()
print "data_1: {}".format(data_1)
print "data_2: {}".format(data_2)
# End of __main__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment