Bug when passing a function as parameter in a delayed function
See original GitHub issueThe following script was working on 0.10.0
:
from joblib import Parallel, delayed
def twice(a):
return 2 * a
def run(method, a):
return method(a)
if __name__ == '__main__':
methods = [twice, ]
results = Parallel(n_jobs=2)(delayed(run)(
method=method, a=10) for method in methods)
Now it returns :
Traceback (most recent call last):
File "/cal/homes/tdupre/work/src/joblib/joblib/externals/loky/process_executor.py", line 338, in _process_worker
call_item = call_queue.get(block=True, timeout=timeout)
File "/cal/homes/tdupre/miniconda3/envs/py36/lib/python3.6/multiprocessing/queues.py", line 113, in get
return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'twice' on <module 'joblib.externals.loky.backend.popen_loky_posix' from '/cal/homes/tdupre/work/src/joblib/joblib/externals/loky/backend/popen_loky_posix.py'>
Traceback (most recent call last):
File "test.py", line 17, in <module>
method=method, a=10) for method in methods)
File "/cal/homes/tdupre/work/src/joblib/joblib/parallel.py", line 814, in __call__
self.retrieve()
File "/cal/homes/tdupre/work/src/joblib/joblib/parallel.py", line 716, in retrieve
self._output.extend(job.get(timeout=self.timeout))
File "/cal/homes/tdupre/work/src/joblib/joblib/_parallel_backends.py", line 402, in wrap_future_result
return future.result(timeout=timeout)
File "/cal/homes/tdupre/work/src/joblib/joblib/externals/loky/_base.py", line 431, in result
return self.__get_result()
File "/cal/homes/tdupre/work/src/joblib/joblib/externals/loky/_base.py", line 382, in __get_result
raise self._exception
joblib.externals.loky.process_executor.BrokenExecutor: A process in the process pool was terminated abruptly while the future was running or pending.
A git bisect leads to #516
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (9 by maintainers)
Top Results From Across the Web
How to pass a delayed function as argument to another ...
I'm writting a function that receives 3 arguments. The first argument is a function/process to be applied to each element of an array, ......
Read more >Delay Function Help - Scripting Support - DevForum
I want to run a delay function that also brings some parameters with it. Delay function returns error “delay function requires 2 arguments”...
Read more >Passing parameters to __delay function!
Hi, I have got a strange issue with the built-in delay function . If i type: int i=10; __delay_ms(i); I get a fail...
Read more >Dask Delayed - Dask documentation
The Dask delayed function decorates your functions so that they operate lazily. Rather than executing your function immediately, it will defer execution, ...
Read more >Function.prototype.bind() - JavaScript - MDN Web Docs - Mozilla
The bound function will store the parameters passed — which include ... the function, using the original object, neatly solves this problem:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would rather like to deprecate the multiprocessing backend in the long term.
Minimal example (sorry for the stupid names). Seems to break when passing lists of functions or class objects to a function. Works fine with single objects.