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:

RuntimeError – If Ray has not been initialized.