lisa.utils.mp_spawn_pool#
- lisa.utils.mp_spawn_pool(import_main=False, **kwargs)[source]#
Create a context manager wrapping
multiprocessing.pool.Pool
using thespawn
method, which is safe even in multithreaded applications.- Parameters:
import_main (bool) – If
True
, let the spawned process import the__main__
module. This is usually not necessary when the functions executed in the pool are small and not importing__main__
saves a lot of time (actually, unbounded amount of time).- Variable keyword arguments:
Forwarded to
multiprocessing.pool.Pool
.