Skip to content

Instantly share code, notes, and snippets.

@spg
Created July 1, 2015 14:43
Show Gist options
  • Save spg/700f5b62ce9c28019fdd to your computer and use it in GitHub Desktop.
Save spg/700f5b62ce9c28019fdd to your computer and use it in GitHub Desktop.
gevent: Pool with greenlets that raise
import gevent.monkey
gevent.monkey.patch_all()
import gevent.pool
def raiseifmod3(n):
if n % 3 == 0:
print n
raise Exception
# I would expect all 100 greenlets to be executed,
# but only the first 10 greenlets are executed,
# then the program exits with status 1
pool = gevent.pool.Pool(10)
pool.map(raiseifmod3, xrange(100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment