joblib / joblib

Computing with Python functions.
http://joblib.readthedocs.org
BSD 3-Clause "New" or "Revised" License
3.83k stars 413 forks source link

Silent Timeout Exception Placeholder #367

Open iandewancker opened 8 years ago

iandewancker commented 8 years ago

In a previous pull request @ogrisel discussed the possibility of returning a placeholder for tasks that timed out instead of raising an exception for the entire job https://github.com/joblib/joblib/pull/340

I have added an option to allow for "silent_timeouts" which will return the TimeoutError as a placeholder instead of

Here is a minimal example :

from time import sleep
from joblib.parallel import Parallel, delayed

def test(x):
  sleep(x)

res = Parallel(n_jobs=4, timeout=0.01, batch_size=1, pre_dispatch='all', silent_timeout=True)(delayed(test)(0.0075 * x) for x in range(10))

output:

[None,
 None,
 None,
 multiprocessing.TimeoutError,
 multiprocessing.TimeoutError,
 multiprocessing.TimeoutError,
 multiprocessing.TimeoutError,
 multiprocessing.TimeoutError,
 multiprocessing.TimeoutError,
 multiprocessing.TimeoutError]

Here is the pull request for this feature. https://github.com/joblib/joblib/pull/366 Interested in people's thoughts, perhaps I have gone about this in an awkward way.

pranavbahl2308 commented 7 years ago

Is this currently available in the library? I get an exception saying "silent_timeout" is an unexpected argument

lesteve commented 7 years ago

There is an open PR for this functionality, see #366. The PR has not been merged so this is not part of the library yet.

josejimenezluna commented 6 years ago

Let's hope they merge this soon!

louismartin commented 4 years ago

Any update on this ?