lisa.utils.mp_spawn_pool#

lisa.utils.mp_spawn_pool(import_main=False, **kwargs)[source]#

Create a context manager wrapping multiprocessing.pool.Pool using the spawn 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.