rlightning.utils.ray.utils

Ray utility functions for distributed computing.

This module provides utility functions for working with Ray actors, object references, and cluster resources.

rlightning.utils.ray.utils.get_cluster_actor_info() Dict[str, List[str]][source]

Get actor info for all actors in the cluster.

Collects information about all non-dead actors and groups them by node. Logs the actor counts per node for debugging.

Returns:

Dictionary mapping node IDs to lists of actor names on that node.

rlightning.utils.ray.utils.get_cluster_nodes() List[Dict[str, Any]][source]

Get the nodes in the cluster.

Returns:

List of dictionaries containing node information, only including nodes that are currently alive.

rlightning.utils.ray.utils.get_cluster_resources() Dict[str, Any][source]

Get cluster resources with per-node details.

Returns a summary compatible with existing callers and adds detailed per-node resource information.

Returns:

  • n_nodes: Number of alive nodes in the cluster.

  • node_id_to_resources: Mapping from node ID to resource info (ip, CPU count, GPU count).

Return type:

Dictionary containing

rlightning.utils.ray.utils.resolve_object(obj: MockModule('ray.ObjectRef') | Sequence[MockModule('ray.ObjectRef')] | Mapping[Any, MockModule('ray.ObjectRef')] | Any) Any[source]

Top-level resolution of Ray ObjectRef(s).

Resolves ObjectRef instances to their actual values. No recursion into nested containers - only handles top-level ObjectRefs.

Parameters:

obj – An ObjectRef, a non-empty Sequence of ObjectRef, or a non-empty Mapping[Any, ObjectRef].

Returns:

The resolved value or a container of the same type when batch-resolved; otherwise, returns the input unchanged.