register_global_parallel_callback#

tpcp.parallel.register_global_parallel_callback(callback: Callable[[], tuple[T, Callable[[T], None]]])[source]#

Register a callback to transfer information to parallel workers.

This callback should be used together with delayed in a joblib parallel context. All calbacks that are registered here will be called when delayed is called in the main process. We expect that the callback returns a value and a setter function. In the worker process, the setter function will be called with the value that was returned by the callback.

As all tpcp functions that use multiprocessing are using delayed, registered callbacks will be called correctly in all tpcp functions.

For details see the docs of delayed.

Parameters:
callbackCallable[[], Tuple[T, Callable[[T], None]]]

The callback function that will be called when delayed is called in the main process. The callback should return a value and a setter function.

Examples using tpcp.parallel.register_global_parallel_callback#

Caching

Caching