run_tasks

sherpa.utils.parallel.run_tasks(procs: Sequence[SupportsProcess], err_q: SupportsQueue[Exception], out_q: SupportsQueue[tuple[int, list[O_co]]], num: Any = None) list[O_co][source] [edit on github]

Run the processes, exiting early if necessary, and return the results.

Changed in version 4.16.0: The num argument is not needed and has been marked optional. It will be removed in a future release.

Parameters:
procslist of multiprocessing.Process tasks

The processes to run.

err_q, out_qmanager.Queue

The error and success channels used by the processes.

numoptional

This argument is unused and will be removed.

Returns:
resultlist

The result from the processes. This may contain more elements than procs, as each process may return multiple results.

Notes

Each process sends its output - a pair with index and a list of results - to the out_q queue, and any error encounteded to the err_q queue. There should be len(procs) messages sent to the out_q queue for a successful run.