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
(self)
| 96 | return node_id |
| 97 | |
| 98 | def get_node_id(self) -> str: |
| 99 | """Get the ID for the node that this process is running on. |
| 100 | |
| 101 | This can be called from within a driver, task, or actor. |
| 102 | When called from a driver that is connected to a remote Ray cluster using |
| 103 | Ray Client, this returns the ID of the head node. |
| 104 | |
| 105 | Returns: |
| 106 | A node id in hex format for this worker or driver. |
| 107 | |
| 108 | Raises: |
| 109 | RuntimeError: If Ray has not been initialized. |
| 110 | """ |
| 111 | if not ray.is_initialized(): |
| 112 | raise RuntimeError( |
| 113 | "Node ID is not available because Ray has not been initialized." |
| 114 | ) |
| 115 | node_id = self.worker.current_node_id |
| 116 | return node_id.hex() |
| 117 | |
| 118 | def get_temp_dir(self) -> str: |
| 119 | """Get the temp directory for the current node. |
nothing calls this directly
no test coverage detected