Made termination condition of imap non-raise-y to keep log spam down.
This commit is contained in:
@@ -142,7 +142,7 @@ class GreenPool(object):
|
|||||||
def _do_map(self, func, it, gi):
|
def _do_map(self, func, it, gi):
|
||||||
for args in it:
|
for args in it:
|
||||||
gi.spawn(func, *args)
|
gi.spawn(func, *args)
|
||||||
gi.spawn(raise_stop_iteration)
|
gi.spawn(return_stop_iteration)
|
||||||
|
|
||||||
def starmap(self, function, iterable):
|
def starmap(self, function, iterable):
|
||||||
"""This is the same as :func:`itertools.starmap`, except that *func* is
|
"""This is the same as :func:`itertools.starmap`, except that *func* is
|
||||||
@@ -164,8 +164,8 @@ class GreenPool(object):
|
|||||||
return self.starmap(function, itertools.izip(*iterables))
|
return self.starmap(function, itertools.izip(*iterables))
|
||||||
|
|
||||||
|
|
||||||
def raise_stop_iteration():
|
def return_stop_iteration():
|
||||||
raise StopIteration()
|
return StopIteration()
|
||||||
|
|
||||||
|
|
||||||
class GreenPile(object):
|
class GreenPile(object):
|
||||||
@@ -227,6 +227,10 @@ class GreenMap(GreenPile):
|
|||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
try:
|
try:
|
||||||
return self.waiters.get().wait()
|
val = self.waiters.get().wait()
|
||||||
|
if isinstance(val, StopIteration):
|
||||||
|
raise val
|
||||||
|
else:
|
||||||
|
return val
|
||||||
finally:
|
finally:
|
||||||
self.counter -= 1
|
self.counter -= 1
|
||||||
|
Reference in New Issue
Block a user