Get current executor IP

I am writing a method for an Actor class. (I am writing a method for a parent class whose child classes will be Ray Actors).

I am wondering if there is a way for me to get the IP address of the ray worker that is executing this actor in the method. For example, if the master IP is ABCD, then if the actor is placed on the master and the method is called, it will return ABCD. Whereas if the actor happens to be placed on a worder node with IP EFGH, then I would like the method to return EFGH.


Yes there is! You can add a method to the actor that returns ray.util.get_node_ip_address(). This will give you the IP address of the node that the actor is running on.

Or you could use a standard util like socket.gethostbyname(socket.gethostname())!