Created
July 1, 2015 14:43
-
-
Save spg/700f5b62ce9c28019fdd to your computer and use it in GitHub Desktop.
gevent: Pool with greenlets that raise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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