Querying node availability in python-chi

In our latest Trovi experiment pattern, we included this snippet for querying availability information against the hardware browser.

from chi import hardware

node_type = "compute_skylake"
available_nodes = hardware.get_nodes(node_type=node_type, filter_reserved=True)
if available_nodes:
    print(f"There currently are {len(available_nodes)} {node_type} nodes ready to use")
else:
    print(f"All {node_type} nodes are in use! You could use next_free_timeslot to see how long you need to wait, or use the calendar.")

We’ve updated python-chi to ensure that this also filters out unreservable nodes, such as those in maintenance.

If you are trying to find availabile times for a node type that is highly utilized, the next_free_timeslot method may be useful, which finds when a node is unreserved.

nodes = hardware.get_nodes(node_type=node_type, filter_reserved=False)
timeslot = nodes[0].next_free_timeslot(minimum_hours=12)
print(timeslot[0], timeslot[1])
---
2025-04-12 00:23:00+00:00 2025-04-15 15:01:00+00:00