ray.runtime_context.RuntimeContext.get_node_id#

RuntimeContext.get_node_id() str[source]#

Get the ID for the node that this process is running on.

This can be called from within a driver, task, or actor. When called from a driver that is connected to a remote Ray cluster using Ray Client, this returns the ID of the head node.

Returns:

A node id in hex format for this worker or driver.

Raises:

AssertionError – If not called in a driver or worker. Generally, this means that ray.init() was not called.