This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |