the joblib
module has provided a tremendously easy-to-use function Parallel
to simplify coding. However, it always gathers all the results before you can access any of them.
I have the need to deal with the results one by one because the results are big arrays taking a lot of memory. They cannot reside in the memory at the same time. So I need to deal with part of them first and then discard. Originally, I used futures.as_completed
method from MultiprocessPool
so that results can be handled immediately when they are available.
But now I also want to use joblib
to manage the memmap
ed arrays for me. Does joblib
also has the interface like MultiprocessPool
? I looked into the code a little and found MemmapingPool
. But these is no document and examples on how to use it.
I have the following questions:
- Do I use them the same as using
MultiprocessPool
? - How to handle
Ctrl-C
in this case?