Core API#

ray.init([address, num_cpus, num_gpus, ...])

Connect to an existing Ray cluster or start one and connect to it.

ray.shutdown([_exiting_interpreter])

Disconnect the worker, and terminate processes started by ray.init().

ray.is_initialized()

Check if ray.init has been called yet.

Tasks#

ray.remote()

Defines a remote function or an actor class.

ray.remote_function.RemoteFunction.options(...)

Configures and overrides the task invocation parameters.

ray.cancel(object_ref, *[, force, recursive])

Cancels a task according to the following conditions.

Actors#

ray.remote()

Defines a remote function or an actor class.

ray.actor.ActorClass.options(**actor_options)

Configures and overrides the actor instantiation parameters.

ray.method(*args, **kwargs)

Annotate an actor method.

ray.get_actor(name[, namespace])

Get a handle to a named actor.

ray.kill(actor, *[, no_restart])

Kill an actor forcefully.

Objects#

ray.get()

Get a remote object or a list of remote objects from the object store.

ray.wait(object_refs, *[, num_returns, ...])

Return a list of IDs that are ready and a list of IDs that are not.

ray.put(value, *[, _owner])

Store an object in the object store.

Runtime Context#

ray.runtime_context.get_runtime_context()

Get the runtime context of the current driver/worker.

ray.runtime_context.RuntimeContext(worker)

A class used for getting runtime context.

ray.get_gpu_ids()

Get the IDs of the GPUs that are available to the worker.

Cross Language#

ray.cross_language.java_function(class_name, ...)

Define a Java function.

ray.cross_language.java_actor_class(class_name)

Define a Java actor class.