RayInterface#
- class eclypse.remote.utils.ray_interface.RayInterface[source]#
Bases:
objectA simple interface to customise and configure the Ray backend used by Eclypse.
Methods
__init__()Initialize the RayInterface.
get(obj)Get the result of a Ray task or a list of Ray tasks.
get_actor(name)Get a Ray actor by its name.
init(runtime_env)Initialize the Ray backend with the given runtime environment.
put(obj)Put an object into the Ray object store.
remote(fn_or_class)Handle the remote execution of a function or class.
Attributes
Get the Ray backend.
- init(runtime_env)[source]#
Initialize the Ray backend with the given runtime environment.
- Parameters:
runtime_env (dict[str, Any]) – The runtime environment to use for Ray.
- get(obj)[source]#
Get the result of a Ray task or a list of Ray tasks.
Ignores any output to stderr.
- Parameters:
obj (ObjectRef) – The Ray task or list of Ray tasks.
- Returns:
The result of the Ray task or list of Ray tasks.
- Return type:
Any | list[Any]
- put(obj)[source]#
Put an object into the Ray object store.
- Parameters:
obj (Any) – The object to put into the Ray object store.
- Returns:
A reference to the object in the Ray object store.
- Return type:
ObjectRef
- get_actor(name)[source]#
Get a Ray actor by its name.
- Parameters:
name (str) – The name of the Ray actor.
- Returns:
The Ray actor handle.
- Return type:
ActorHandle
- remote(fn_or_class)[source]#
Handle the remote execution of a function or class.
- Parameters:
fn_or_class – The function or class to execute remotely.
- Returns:
A reference to the remote execution result.
- Return type:
ObjectRef
- property backend#
Get the Ray backend.
If the backend is not initialised, it will attempt to import Ray and set it as the backend.
- Returns:
The Ray backend.
- Return type:
Any
- Raises:
ImportError – If Ray cannot be imported, indicating that the required dependencies are missing.