def METHOD_NAME(update_cmds, batch_size):
    num_workers = min(batch_size, len(update_cmds))
    pool = WorkerPool(num_workers)
    for uc in update_cmds:
        pool.addCommand(uc)
    try:
        pool.join()
    except Exception as e:
        pool.haltWork()
        pool.joinWorkers()
    failure = False
    for cmd in pool.getCompletedItems():
        r = cmd.get_results()
        if not cmd.was_successful():
           logger.error("Unable to update pg_hba conf on primary segment: " + str(r))
           failure = True
    pool.haltWork()
    pool.joinWorkers()
    if failure:
        logger.error("Unable to update pg_hba.conf on the primary segments")
        raise Exception("Unable to update pg_hba.conf on the primary segments.")