gemseo / utils / multiprocessing

Hide inherited members

execution module

Multiprocessing execution.

gemseo.utils.multiprocessing.execution.execute(worker, callbacks, n_processes, inputs)[source]

Run the worker with the given inputs in sequential or parallel mode.

Parameters:
  • worker (Callable) – The object that performs the tasks.

  • callbacks (Iterable[CallbackType]) – Callback functions called with the pair (index, outputs) as arguments when an item is retrieved from the processing. Index is the associated index in inputs of the input used to compute the outputs. If empty, no function is called.

  • n_processes (int) – The number of processes used to evaluate the inputs.

  • inputs (NumberArray | list[int]) – The inputs to be evaluated.

Returns:

The outputs of the evaluations.

Return type:

list[Any]