in src/hpc/autoscale/example/readme.py [0:0]
def onprem_burst_node_mgr() -> None:
# Unlike the SchedulerNode above, here we can define the vcpu_count and memory
# for the onprem nodes.
onprem_res = {"onprem": True, "nodetype": "A"}
onprem001 = UnmanagedNode(
"onprem001", vcpu_count=16, memory=Memory(128, "g"), resources=onprem_res
)
onprem002 = UnmanagedNode(
"onprem002", vcpu_count=32, memory=Memory(256, "g"), resources=onprem_res
)
node_mgr = new_node_manager(CONFIG, existing_nodes=[onprem001, onprem002])
node_mgr.add_default_resource({"node.nodearray": "htc"}, "nodetype", "A")
result = node_mgr.allocate({"nodetype": "A"}, node_count=5)
assert result
if result:
print(
"Allocated {} nodes, {} are new".format(
len(result.nodes), len(node_mgr.new_nodes)
)
)
else:
print("Failed! {}".format(result))
if not DRY_RUN:
node_mgr.bootup()