Ray Client support in mini-cluster mode

Is there a client support in ray mini-cluster mode?
I couldn’t manager to connect (Py 3.8, Ray 2.0.0.dev0, Windows 10).

Ah, you should just be able to do:

$ ray start --head

then

ray.util.connect("localhost:10001")

I was referring to a mini-cluster, so I start the cluster with a code like this:

from ray.cluster_utils import Cluster

Starts a head-node for the cluster.

cluster = Cluster(
initialize_head=True,
head_node_args={
“num_cpus”: 10,
})

I think you can just start a mini cluster in a driver (with the while loop so that the driver won’t terminate) and use ray.util.connect("localhost:10001")

you may need to manually start the Ray service – see some of the tests we run in ray/python/ray/tests/test_client.py.

@sangcho What do you mean by ‘in a driver’? Can you please provide a short code sample?

@rliaw Confirmed to work when starting ray with a ‘subprocess’ commad, e.g.:

    import subprocess
    subprocess.run("ray start --head --include-dashboard=false", check=True)

Ah, sorry it is not a driver, just a python script.

from ray.cluster_utils import Cluster
# Pseudo code
c = Cluster()
c.add_node
...

import time
while True:
    # script shouldn't exit otherwise the mini cluster will crash
    time.sleep(1)

@sangcho Thnx, but I’ve already managed to make it work by simply running ray instance with ‘subprocess’ module.