Skip to content

Instantly share code, notes, and snippets.

@fishbone
fishbone / autoscaler-with-locality.py
Last active March 7, 2023 03:29 — forked from udayk13/autoscaler-with-locality.py
Snippet to test autoscaling with placement groups
import ray
import time
ray.init('auto')
def print_node_status():
nodes = ray.nodes()
alive_nodes = [n for n in nodes if n['alive']]
print(f"Alive nodes: {len(alive_nodes)}, total nodes: {len(nodes)}")
return len(alive_nodes)