Do you know how I can run this Python script on the Ray cluster without using ray job submit
?
from collections import Counter
import socket
import time
import ray ray.init()
@ray.remote
def f():
time.sleep(0.001) # Return IP address.
return socket.gethostbyname(socket.gethostname())
object_ids = [f.remote() for _ in range(100)]
ip_addresses = ray.get(object_ids) print(Counter(ip_addresses))
At the moment I use scripts like the following to execute on the cluster. But I would prefer to do it without the script so that I can execute from Spyder, Jupyter or other interactive environments.
export RAY_ADDRESS="[http://192.168.26.185:30002](http://192.168.26.185:30002/)" runtime_env="..."
cd $HOME/PycharmProjects/abcd/
script="scripts/ray/script.py"
ray job submit --runtime-env "$runtime_env" python3.9 "$script"
I get this error:
AssertionError: Module: http does not have ClientBuilder.
I’ve also tried removing http:// from the front of RAY_ADDRESS, and changing http:// to ray://, but neither of those work.