run_multiprocessing#

gammapy.utils.parallel.run_multiprocessing(func, inputs, backend=None, pool_kwargs=None, method=None, method_kwargs=None, task_name='')[source]#

Run function in a loop or in Parallel.

Parameters
funcfunction

Function to run.

inputslist

List of arguments to pass to the function.

backend{‘multiprocessing’, ‘ray’}, optional

Backend to use. Default is None.

pool_kwargsdict, optional

Keyword arguments passed to the pool. The number of processes is limited to the number of physical CPUs. Default is None.

method{‘starmap’, ‘apply_async’}

Pool method to use. Default is “starmap”.

method_kwargsdict, optional

Keyword arguments passed to the method. Default is None.

task_namestr, optional

Name of the task to display in the progress bar. Default is “”.

Notes

The progress bar can be displayed for this function.