lenskit.parallel.ray ==================== .. py:module:: lenskit.parallel.ray .. autoapi-nested-parse:: Support for parallelism with Ray. Attributes ---------- .. autoapisummary:: lenskit.parallel.ray.BATCH_SIZE Classes ------- .. toctree:: :hidden: /api/lenskit/parallel/ray/TaskLimiter .. autoapisummary:: lenskit.parallel.ray.TaskLimiter Functions --------- .. autoapisummary:: lenskit.parallel.ray.ensure_cluster lenskit.parallel.ray.init_cluster lenskit.parallel.ray.init_serializers lenskit.parallel.ray.ray_available lenskit.parallel.ray.ray_active lenskit.parallel.ray.is_ray_worker lenskit.parallel.ray.init_worker Module Contents --------------- .. py:data:: BATCH_SIZE :value: 200 .. py:function:: ensure_cluster() .. py:function:: 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. :param num_cpus: The total number of CPUs to allow. Defaults to :fun:`effective_cpu_count`. :param proc_slots: The number of “process slots” for LensKit parallel operations. Defaults to the LensKit process count. These slots are recorded as the ``lk_process`` resource on the Ray cluster. :param resources: Additional custom resources to register in the Ray cluster. :param global_logging: ``True`` to wire up logging in the workers at startup, instead of only connecting logs when a task is run. :param kwargs: Other options to pass to :func:`ray.init`. :Stability: Experimental .. py:function:: init_serializers() .. py:function:: ray_available() Check if Ray is available. .. py:function:: ray_active() Query whether Ray is active. .. py:function:: is_ray_worker() Determine whether the current process is running on a Ray worker. .. py:function:: init_worker(*, autostart = True) Initialize a Ray worker process. Sets up logging, and returns the context. :param autostart: Set to ``False`` to disable calling :meth:`WorkerContext.start`, for when the caller will start and stop the context if it is new. Exported Aliases ---------------- .. py:function:: lenskit.parallel.ray.get_logger Re-exported alias for :py:func:`lenskit.logging.get_logger`. .. py:class:: lenskit.parallel.ray.WorkerContext Re-exported alias for :py:class:`lenskit.logging.multiprocess.WorkerContext`. .. py:class:: lenskit.parallel.ray.WorkerLogConfig Re-exported alias for :py:class:`lenskit.logging.multiprocess.WorkerLogConfig`. .. py:function:: lenskit.parallel.ray.effective_cpu_count Re-exported alias for :py:func:`lenskit.parallel.config.effective_cpu_count`. .. py:function:: lenskit.parallel.ray.ensure_parallel_init Re-exported alias for :py:func:`lenskit.parallel.config.ensure_parallel_init`. .. py:function:: lenskit.parallel.ray.get_parallel_config Re-exported alias for :py:func:`lenskit.parallel.config.get_parallel_config`.