@Override public synchronized void addQueue(Queue queue) throws SchedulerDynamicEditException { if (!(queue instanceof ReservationQueue)) { throw new SchedulerDynamicEditException("Queue " + queue.getQueueName() + " is not a ReservationQueue"); } ReservationQueue newQueue = (ReservationQueue) queue; if (newQueue.getParent() == null || !(newQueue.getParent() instanceof PlanQueue)) { throw new SchedulerDynamicEditException("ParentQueue for " + newQueue.getQueueName() + " is not properly set (should be set and be a PlanQueue)"); } PlanQueue parentPlan = (PlanQueue) newQueue.getParent(); String queuename = newQueue.getQueueName(); parentPlan.addChildQueue(newQueue); this.queues.put(queuename, newQueue); LOG.info("Creation of ReservationQueue " + newQueue + " succeeded"); }
@Override public synchronized void addQueue(Queue queue) throws SchedulerDynamicEditException { if (!(queue instanceof ReservationQueue)) { throw new SchedulerDynamicEditException("Queue " + queue.getQueueName() + " is not a ReservationQueue"); } ReservationQueue newQueue = (ReservationQueue) queue; if (newQueue.getParent() == null || !(newQueue.getParent() instanceof PlanQueue)) { throw new SchedulerDynamicEditException("ParentQueue for " + newQueue.getQueueName() + " is not properly set (should be set and be a PlanQueue)"); } PlanQueue parentPlan = (PlanQueue) newQueue.getParent(); String queuename = newQueue.getQueueName(); parentPlan.addChildQueue(newQueue); this.queues.put(queuename, newQueue); LOG.info("Creation of ReservationQueue " + newQueue + " succeeded"); }
@Override public synchronized void removeQueue(String queueName) throws SchedulerDynamicEditException { LOG.info("Removing queue: " + queueName); CSQueue q = this.getQueue(queueName); if (!(q instanceof ReservationQueue)) { throw new SchedulerDynamicEditException("The queue that we are asked " + "to remove (" + queueName + ") is not a ReservationQueue"); } ReservationQueue disposableLeafQueue = (ReservationQueue) q; // at this point we should have no more apps if (disposableLeafQueue.getNumApplications() > 0) { throw new SchedulerDynamicEditException("The queue " + queueName + " is not empty " + disposableLeafQueue.getApplications().size() + " active apps " + disposableLeafQueue.pendingApplications.size() + " pending apps"); } ((PlanQueue) disposableLeafQueue.getParent()).removeChildQueue(q); this.queues.remove(queueName); LOG.info("Removal of ReservationQueue " + queueName + " has succeeded"); }
@Override public synchronized void removeQueue(String queueName) throws SchedulerDynamicEditException { LOG.info("Removing queue: " + queueName); CSQueue q = this.getQueue(queueName); if (!(q instanceof ReservationQueue)) { throw new SchedulerDynamicEditException("The queue that we are asked " + "to remove (" + queueName + ") is not a ReservationQueue"); } ReservationQueue disposableLeafQueue = (ReservationQueue) q; // at this point we should have no more apps if (disposableLeafQueue.getNumApplications() > 0) { throw new SchedulerDynamicEditException("The queue " + queueName + " is not empty " + disposableLeafQueue.getApplications().size() + " active apps " + disposableLeafQueue.pendingApplications.size() + " pending apps"); } ((PlanQueue) disposableLeafQueue.getParent()).removeChildQueue(q); this.queues.remove(queueName); LOG.info("Removal of ReservationQueue " + queueName + " has succeeded"); }
/** * This methods to change capacity for a queue and adjusts its * absoluteCapacity * * @param entitlement the new entitlement for the queue (capacity, * maxCapacity, etc..) * @throws SchedulerDynamicEditException */ public synchronized void setEntitlement(QueueEntitlement entitlement) throws SchedulerDynamicEditException { float capacity = entitlement.getCapacity(); if (capacity < 0 || capacity > 1.0f) { throw new SchedulerDynamicEditException( "Capacity demand is not in the [0,1] range: " + capacity); } setCapacity(capacity); setAbsoluteCapacity(getParent().getAbsoluteCapacity() * getCapacity()); // note: we currently set maxCapacity to capacity // this might be revised later setMaxCapacity(entitlement.getMaxCapacity()); if (LOG.isDebugEnabled()) { LOG.debug("successfully changed to " + capacity + " for queue " + this.getQueueName()); } }
/** * This methods to change capacity for a queue and adjusts its * absoluteCapacity * * @param entitlement the new entitlement for the queue (capacity, * maxCapacity, etc..) * @throws SchedulerDynamicEditException */ public synchronized void setEntitlement(QueueEntitlement entitlement) throws SchedulerDynamicEditException { float capacity = entitlement.getCapacity(); if (capacity < 0 || capacity > 1.0f) { throw new SchedulerDynamicEditException( "Capacity demand is not in the [0,1] range: " + capacity); } setCapacity(capacity); setAbsoluteCapacity(getParent().getAbsoluteCapacity() * getCapacity()); // note: we currently set maxCapacity to capacity // this might be revised later setMaxCapacity(entitlement.getMaxCapacity()); if (LOG.isDebugEnabled()) { LOG.debug("successfully changed to " + capacity + " for queue " + this.getQueueName()); } }