straindesign.pool

Provide a process pool with enhanced performance on Windows, copied and slightly adapted from cobra.

Module Contents

class straindesign.pool.SDPool(processes: int | None = None, initializer: Callable | None = None, initargs: Tuple = (), maxtasksperchild: int | None = None, context=None)[source]

Bases: multiprocessing.pool.Pool

Multiprocessing process pool with enhanced Windows compatibility

Initialize a process pool.

Add a thin layer on top of the multiprocessing.Pool that, on Windows, passes initialization code to workers via a pickle file rather than directly. This is done to avoid a performance issue that exists on Windows. Please, also see the discussion [1].

References

__exit__(*args, **kwargs)[source]

Clean up resources when leaving a context

close()[source]

Call cleanup function and close