tpcp.parallel: Context-aware parallel execution#
For practical caveats around joblib-based multiprocessing, worker state, serialization, and import costs, see Multiprocessing Caveats.
Helpers for restoring TPCP runtime context in joblib workers.
The worker-state helpers are required as long as joblib/joblib#1071 is not resolved.
The delayed wrapper restores registered global state, Python warning filters,
and active warning/error contexts for each worker task. Parallel additionally
recovers side-channel data from successful tasks without changing their return values.
Applications can add their own round-trip state with register_parallel_side_channel.
The provided workarounds are similar to the ones done in scikit-learn (scikit-learn/scikit-learn#25363).
Note, that these fixes are not necessarily compatible with each other. This means you can not forward custom callbacks through scikit-learn Parallel calls. The same way, by default tpcp will not forward sklearn global configs through tpcp Parallel calls. However, you can likely configure the callbacks in tpcp to make that work.
Functions#
|
Wrap a function to be used in a parallel context. |
|
Register a callback to transfer information to parallel workers. |
|
Register state that can make a round trip through a parallel worker. |
Remove a registered callback. |
|
Remove a side channel registered with |
Classes#
|
Run joblib tasks and recover side-channel data from TPCP worker contexts. |