lenskit.parallel.ray#
Support for parallelism with Ray.
Attributes#
Classes#
Limit task concurrency using |
Functions#
|
Initialize or connect to a Ray cluster, with the LensKit options. |
Check if Ray is available. |
|
Query whether Ray is active. |
|
Determine whether the current process is running on a Ray worker. |
|
|
Initialize a Ray worker process. Sets up logging, and returns the context. |
Module Contents#
- lenskit.parallel.ray.BATCH_SIZE = 200#
- lenskit.parallel.ray.ensure_cluster()#
- lenskit.parallel.ray.init_cluster(*, num_cpus=None, resources=None, global_logging=False, **kwargs)#
Initialize or connect to a Ray cluster, with the LensKit options.
The resulting cluster can be used by an invoker, or it can be used directly. The Ray invoker uses batching, though, so it only works well with many small tasks.
- Parameters:
num_cpus (int | None) – The total number of CPUs to allow. Defaults to :fun:`effective_cpu_count`.
proc_slots – The number of “process slots” for LensKit parallel operations. Defaults to the LensKit process count. These slots are recorded as the
lk_processresource on the Ray cluster.resources (dict[str, float] | None) – Additional custom resources to register in the Ray cluster.
global_logging (bool) –
Trueto wire up logging in the workers at startup, instead of only connecting logs when a task is run.kwargs – Other options to pass to
ray.init().
- Stability:
Experimental
- lenskit.parallel.ray.init_serializers()#
- lenskit.parallel.ray.is_ray_worker()#
Determine whether the current process is running on a Ray worker.
- Return type:
Exported Aliases#
- lenskit.parallel.ray.get_logger()#
Re-exported alias for
lenskit.logging.get_logger().
- class lenskit.parallel.ray.WorkerContext#
Re-exported alias for
lenskit.logging.multiprocess.WorkerContext.
- class lenskit.parallel.ray.WorkerLogConfig#
Re-exported alias for
lenskit.logging.multiprocess.WorkerLogConfig.
- lenskit.parallel.ray.effective_cpu_count()#
Re-exported alias for
lenskit.parallel.config.effective_cpu_count().
- lenskit.parallel.ray.ensure_parallel_init()#
Re-exported alias for
lenskit.parallel.config.ensure_parallel_init().
- lenskit.parallel.ray.get_parallel_config()#
Re-exported alias for
lenskit.parallel.config.get_parallel_config().