def resize_pool_multi_attempt()

in src/hpcadvisor/batch_handler.py [0:0]


def resize_pool_multi_attempt(poolname, number_of_nodes):
    attempts = 3
    while attempts > 0:
        rc = resize_pool(poolname, number_of_nodes)
        if not rc:
            log.warning(
                f"Failed to resize pool: {poolname} to {number_of_nodes}. Attempts left: {attempts}"
            )
            resize_pool(poolname, 0)
            attempts -= 1
        else:
            return True

    log.warning(f"Failed to resize pool: {poolname} to {number_of_nodes}")
    resize_pool(poolname, 0)
    return False