Skip to content

Instantly share code, notes, and snippets.

@illicitonion
Created October 9, 2011 01:34
Show Gist options
  • Select an option

  • Save illicitonion/1273167 to your computer and use it in GitHub Desktop.

Select an option

Save illicitonion/1273167 to your computer and use it in GitHub Desktop.
import random
from multiprocessing import Pool
from time import sleep
def Process(x):
try:
print str(x)
sleep(random.random())
raise Exception('Foo: ' + str(x))
finally:
print 'Finally: ' + str(x)
x = 5
Pool(x).map(Process, range(0, x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment