lenskit.parallel.pool#

Functions

multiprocess_executor([n_jobs, sp_config])

Construct a ProcessPoolExecutor configured for LensKit work.

Classes

LenskitMPContext(parallel)

LensKit multiprocessing context.

LenskitProcess(logging, parallel, *args, ...)

LensKit worker process implementation.

ProcessPoolOpInvoker(model, func, n_jobs[, ...])

lenskit.parallel.pool.multiprocess_executor(n_jobs=None, sp_config=None)#

Construct a ProcessPoolExecutor configured for LensKit work.

Parameters:
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 to func.

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:
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)

Process(*args, **kwargs)#

Process objects represent activity that is run in a separate process

The class is analogous to threading.Thread

Parameters:
Return type:

SpawnProcess