use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.policy.PriorityUtilizationQueueOrderingPolicy in project hadoop by apache.
the class TestQueueParsing method testQueueOrderingPolicyUpdatedAfterReinitialize.
@Test
public void testQueueOrderingPolicyUpdatedAfterReinitialize() throws IOException {
CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration();
setupQueueConfigurationWithoutLabels(csConf);
YarnConfiguration conf = new YarnConfiguration(csConf);
CapacityScheduler capacityScheduler = new CapacityScheduler();
RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), new ClientToAMTokenSecretManagerInRM(), null);
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(conf);
capacityScheduler.setRMContext(rmContext);
capacityScheduler.init(conf);
capacityScheduler.start();
// Add a new b4 queue
csConf.setQueues(CapacitySchedulerConfiguration.ROOT + ".b", new String[] { "b1", "b2", "b3", "b4" });
csConf.setCapacity(CapacitySchedulerConfiguration.ROOT + ".b.b4", 0f);
ParentQueue bQ = (ParentQueue) capacityScheduler.getQueue("b");
checkEqualsToQueueSet(bQ.getChildQueues(), new String[] { "b1", "b2", "b3" });
capacityScheduler.reinitialize(new YarnConfiguration(csConf), rmContext);
// Check child queue of b
checkEqualsToQueueSet(bQ.getChildQueues(), new String[] { "b1", "b2", "b3", "b4" });
PriorityUtilizationQueueOrderingPolicy queueOrderingPolicy = (PriorityUtilizationQueueOrderingPolicy) bQ.getQueueOrderingPolicy();
checkEqualsToQueueSet(queueOrderingPolicy.getQueues(), new String[] { "b1", "b2", "b3", "b4" });
ServiceOperations.stopQuietly(capacityScheduler);
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.policy.PriorityUtilizationQueueOrderingPolicy in project hadoop by apache.
the class CapacitySchedulerConfiguration method getQueueOrderingPolicy.
@Private
public QueueOrderingPolicy getQueueOrderingPolicy(String queue, String parentPolicy) {
String defaultPolicy = parentPolicy;
if (null == defaultPolicy) {
defaultPolicy = DEFAULT_QUEUE_ORDERING_POLICY;
}
String policyType = get(getQueuePrefix(queue) + ORDERING_POLICY, defaultPolicy);
QueueOrderingPolicy qop;
if (policyType.trim().equals(QUEUE_UTILIZATION_ORDERING_POLICY)) {
// Doesn't respect priority
qop = new PriorityUtilizationQueueOrderingPolicy(false);
} else if (policyType.trim().equals(QUEUE_PRIORITY_UTILIZATION_ORDERING_POLICY)) {
qop = new PriorityUtilizationQueueOrderingPolicy(true);
} else {
String message = "Unable to construct queue ordering policy=" + policyType + " queue=" + queue;
throw new YarnRuntimeException(message);
}
return qop;
}
Aggregations