ray/benchmarks/distributed/wait_cluster.py
Alex Wu 9e79301d35
Split scalability envelope + smoke tests (#17455)
* .

* done?

* done?

* sang comments

* .

Co-authored-by: Alex Wu <alex@anyscale.com>
2021-07-30 10:20:19 -07:00

25 lines
515 B
Python

import click
import ray
import time
def num_alive_nodes():
n = 0
for node in ray.nodes():
if node["Alive"]:
n += 1
return n
@click.command()
@click.option(
"--num-nodes", required=True, type=int, help="The target number of nodes")
def wait_cluster(num_nodes: int):
ray.init(address="auto")
while num_alive_nodes() != num_nodes:
print(f"Waiting for nodes: {num_alive_nodes()}/{num_nodes}")
time.sleep(5)
if __name__ == "__main__":
wait_cluster()