lenskit.parallel.pool#
Functions
|
Construct a |
Classes
|
LensKit multiprocessing context. |
|
LensKit worker process implementation. |
|
- lenskit.parallel.pool.multiprocess_executor(n_jobs=None, sp_config=None)#
Construct a
ProcessPoolExecutor
configured for LensKit work.- Parameters:
n_jobs (int | None)
sp_config (ParallelConfig | None)
- Return type:
ProcessPoolExecutor
- class lenskit.parallel.pool.ProcessPoolOpInvoker(model, func, n_jobs, worker_parallel=None)#
Bases:
ModelOpInvoker
[A
,R
],Generic
[M
,A
,R
]- Parameters:
model (M)
func (InvokeOp[M, A, R])
n_jobs (int)
worker_parallel (ParallelConfig | None)
- map(tasks)#
Apply the configured function to the model and iterables. This is like
map()
, except it supplies the invoker’s model as the first object tofunc
.- Parameters:
iterables – Iterables of arguments to provide to the function.
tasks (Iterable[A])
- Returns:
An iterable of the results.
- Return type:
iterable
- class lenskit.parallel.pool.LenskitProcess(logging, parallel, *args, **kwargs)#
Bases:
SpawnProcess
LensKit worker process implementation.
- Parameters:
logging (WorkerLogConfig)
parallel (ParallelConfig)
args (Any)
kwargs (Any)
- run()#
Method to be run in sub-process; can be overridden in sub-class
- class lenskit.parallel.pool.LenskitMPContext(parallel)#
Bases:
SpawnContext
LensKit multiprocessing context.
- Parameters:
parallel (ParallelConfig)