Skip to content

Commit

Permalink
YARN-3764. CapacityScheduler should forbid moving LeafQueue from one …
Browse files Browse the repository at this point in the history
…parent to another. Contributed by Wangda Tan
  • Loading branch information
jian-he committed Jun 4, 2015
1 parent ade6d9a commit 6ad4e59
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
3 changes: 3 additions & 0 deletions hadoop-yarn-project/CHANGES.txt
Expand Up @@ -626,6 +626,9 @@ Release 2.7.1 - UNRELEASED
YARN-3733. Fix DominantRC#compare() does not work as expected if
cluster resource is empty. (Rohith Sharmaks via wangda)

YARN-3764. CapacityScheduler should forbid moving LeafQueue from one parent
to another. (Wangda Tan via jianhe)

Release 2.7.0 - 2015-04-20

INCOMPATIBLE CHANGES
Expand Down
Expand Up @@ -551,8 +551,15 @@ private void validateExistingQueues(
// check that all static queues are included in the newQueues list
for (Map.Entry<String, CSQueue> e : queues.entrySet()) {
if (!(e.getValue() instanceof ReservationQueue)) {
if (!newQueues.containsKey(e.getKey())) {
throw new IOException(e.getKey() + " cannot be found during refresh!");
String queueName = e.getKey();
CSQueue oldQueue = e.getValue();
CSQueue newQueue = newQueues.get(queueName);
if (null == newQueue) {
throw new IOException(queueName + " cannot be found during refresh!");
} else if (!oldQueue.getQueuePath().equals(newQueue.getQueuePath())) {
throw new IOException(queueName + " is moved from:"
+ oldQueue.getQueuePath() + " to:" + newQueue.getQueuePath()
+ " after refresh, which is not allowed.");
}
}
}
Expand Down
Expand Up @@ -865,4 +865,37 @@ public void testQueueParsingWithSumOfChildLabelCapacityNot100PercentWithWildCard
capacityScheduler.start();
ServiceOperations.stopQuietly(capacityScheduler);
}

@Test(expected = IOException.class)
public void testQueueParsingWithMoveQueue()
throws IOException {
YarnConfiguration conf = new YarnConfiguration();
CapacitySchedulerConfiguration csConf =
new CapacitySchedulerConfiguration(conf);
csConf.setQueues("root", new String[] { "a" });
csConf.setQueues("root.a", new String[] { "x", "y" });
csConf.setCapacity("root.a", 100);
csConf.setCapacity("root.a.x", 50);
csConf.setCapacity("root.a.y", 50);

CapacityScheduler capacityScheduler = new CapacityScheduler();
RMContextImpl rmContext =
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
new ClientToAMTokenSecretManagerInRM(), null);
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(csConf);
capacityScheduler.setRMContext(rmContext);
capacityScheduler.init(csConf);
capacityScheduler.start();

csConf.setQueues("root", new String[] { "a", "x" });
csConf.setQueues("root.a", new String[] { "y" });
csConf.setCapacity("root.x", 50);
csConf.setCapacity("root.a", 50);
csConf.setCapacity("root.a.y", 100);

capacityScheduler.reinitialize(csConf, rmContext);
}
}

0 comments on commit 6ad4e59

Please sign in to comment.