atomica.utils.parallel_progress¶
- atomica.utils.parallel_progress(fcn, inputs, num_workers=None, show_progress=True)[source]¶
Run a function in parallel with a optional single progress bar
The result is essentially equivalent to
>>> list(map(fcn, inputs))
But with execution in parallel and with a single progress bar being shown. The Atomica logger level will be changed to hide output below the WARNING level.
- Parameters:
fcn – Function object to call, accepting one argument, OR a function with zero arguments in which case inputs should be an integer
inputs – A collection of inputs that will each be passed to (list, array, etc.) OR a number, if the fcn() has no input arguments
num_workers – Number of processes, defaults to the number of CPUs
- Return type:
- Returns:
An list of outputs