@Override public void editSchedule() { Collection<Plan> plans = getContext().getReservationSystem().getAllPlans().values(); try { for (Plan plan : plans) { long currReservations = plan.getReservationsAtTime(clock.getTime()).size(); long numberReservationQueues = getContext().getScheduler() .getQueueInfo(plan.getQueueName(), true, false).getChildQueues() .size(); if (currReservations != numberReservationQueues - 1) { logOrThrow("Number of reservations (" + currReservations + ") does NOT match the number of reservationQueues (" + (numberReservationQueues - 1) + "), while it should."); } } } catch (IOException io) { throw new InvariantViolationException("Issue during invariant check: ", io); } }
private void registerNode(String host, int memory, int vCores) throws Exception { try { resourceManager.registerNode(host, memory, vCores); int attempts = 10; Collection<Plan> plans; do { resourceManager.drainEvents(); LOG.info("Waiting for node capacity to be added to plan"); plans = resourceManager.getRMContext().getReservationSystem() .getAllPlans().values(); if (checkCapacity(plans)) { break; } Thread.sleep(100); } while (attempts-- > 0); if (attempts <= 0) { Assert.fail("Exhausted attempts in checking if node capacity was " + "added to the plan"); } } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }