Skip to content

Commit

Permalink
BUG: Make sure that the original exception is raised when using single
Browse files Browse the repository at this point in the history
processing, to facilitate debugging.
  • Loading branch information
GaelVaroquaux committed Sep 5, 2010
1 parent c385432 commit e4c6adf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions joblib/parallel.py
Expand Up @@ -77,9 +77,8 @@ def delayed_function(*args, **kwargs):
return delayed_function


class LazyApply (object):
"""
Lazy version of the apply builtin function.
class LazyApply(object):
""" Lazy version of the apply builtin function.
"""
def __init__ (self, func, args, kwargs):
self.func = func
Expand All @@ -90,6 +89,7 @@ def get (self):
return self.func(*self.args, **self.kwargs)



class Parallel(Logger):
''' Helper class for readable parallel mapping.
Expand Down Expand Up @@ -208,13 +208,13 @@ def __call__(self, iterable):
apply = LazyApply
else:
pool = multiprocessing.Pool(n_jobs)
apply = pool.apply_async
def apply(func, args, kwargs):
return pool.apply_async(SafeFunction(function), args, kwargs)

output = list()
start_time = time.time()
try:
for index, (function, args, kwargs) in enumerate(iterable):
function = SafeFunction(function)
output.append(apply(function, args, kwargs))
if self.verbose and n_jobs == 1:
print '[%s]: Done job %3i | elapsed: %s' % (
Expand Down

0 comments on commit e4c6adf

Please sign in to comment.