merton.batch.dispatch¶
Parallel-dispatch helpers shared by panel-fitting entry points.
The default is joblib (prefer="threads") because our hot path
releases the GIL inside the Numba kernels — threading scales well without
the overhead of process pools. For users who already have a Dask or Ray
cluster, the same panel API accepts dispatch="dask" / "ray" and
falls back to lazy imports.
Functions¶
|
Apply |
Module Contents¶
- merton.batch.dispatch.parallel_map(fn: collections.abc.Callable[[T], R], items: collections.abc.Sequence[T], *, dispatch: str = 'joblib', n_jobs: int = -1, progress: bool = False, description: str = 'merton') list[R][source]¶
Apply
fnto every element ofitemsin parallel.- Parameters:
dispatch –
"joblib"(default, threads) |"sequential"|"dask"|"ray". Dask / Ray require the corresponding library to be installed; we lazy-import on first use.n_jobs – Number of parallel workers.
-1means all logical cores.progress – Show a
rich.progressbar for the dispatch.description – Label shown alongside the progress bar.