in src/hpcadvisor/batch_handler.py [0:0]
def resize_pool(poolid, target_nodes, wait_resize=True):
log.info(f"Resizing pool '{poolid}' to {target_nodes} nodes...")
if not batch_client:
log.critical("batch_client is None")
return
if not poolid:
log.critical("poolid is None and cannot resize pool")
return
current_nodes = batch_client.pool.get(poolid).current_dedicated_nodes
log.info(f"current nodes={current_nodes} target nodes={target_nodes}")
pool = batch_client.pool.get(poolid)
log.debug(f"Pool state={pool.allocation_state}")
# TODO: revisit this
# need to wait until the current resizing is completed
# it seems batch does not queue resizing requests
while True:
pool = batch_client.pool.get(poolid)
log.debug(f"before asking resize. pool state={pool.allocation_state}")
if pool.allocation_state == "steady":
break
time.sleep(5)
batch_client.pool.resize(
pool_id=poolid,
pool_resize_parameter=batchmodels.PoolResizeParameter(
target_dedicated_nodes=target_nodes,
target_low_priority_nodes=0,
resize_timeout=pool.resize_timeout,
# node_deallocation_option=pool.resize_deallocation_option,
),
)
if wait_resize:
return wait_pool_ready(poolid)