YARN-3395. FairScheduler: Trim whitespaces when using username for queuename. (Zhihai Xu via kasha)
This commit is contained in:
parent
1773aac780
commit
a60f78e98e
@ -221,6 +221,9 @@ Release 2.8.0 - UNRELEASED
|
||||
YARN-1287. Consolidate MockClocks.
|
||||
(Sebastian Wong and Anubhav Dhoot via kasha)
|
||||
|
||||
YARN-3395. FairScheduler: Trim whitespaces when using username for
|
||||
queuename. (Zhihai Xu via kasha)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
YARN-3339. TestDockerContainerExecutor should pull a single image and not
|
||||
|
@ -345,9 +345,11 @@ public boolean isTerminal() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the periods in the username or groupname with "_dot_".
|
||||
* Replace the periods in the username or groupname with "_dot_" and
|
||||
* remove trailing and leading whitespace.
|
||||
*/
|
||||
protected String cleanName(String name) {
|
||||
name = name.trim();
|
||||
if (name.contains(".")) {
|
||||
String converted = name.replaceAll("\\.", "_dot_");
|
||||
LOG.warn("Name " + name + " is converted to " + converted
|
||||
|
@ -4335,4 +4335,39 @@ public void testEmptyQueueNameInConfigFile() throws IOException {
|
||||
"Failed to initialize FairScheduler"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUserAsDefaultQueueWithLeadingTrailingSpaceUserName()
|
||||
throws Exception {
|
||||
conf.set(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, "true");
|
||||
scheduler.init(conf);
|
||||
scheduler.start();
|
||||
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
||||
ApplicationAttemptId appAttemptId = createAppAttemptId(1, 1);
|
||||
createApplicationWithAMResource(appAttemptId, "default", " user1", null);
|
||||
assertEquals(1, scheduler.getQueueManager().getLeafQueue("user1", true)
|
||||
.getNumRunnableApps());
|
||||
assertEquals(0, scheduler.getQueueManager().getLeafQueue("default", true)
|
||||
.getNumRunnableApps());
|
||||
assertEquals("root.user1", resourceManager.getRMContext().getRMApps()
|
||||
.get(appAttemptId.getApplicationId()).getQueue());
|
||||
|
||||
ApplicationAttemptId attId2 = createAppAttemptId(2, 1);
|
||||
createApplicationWithAMResource(attId2, "default", "user1 ", null);
|
||||
assertEquals(2, scheduler.getQueueManager().getLeafQueue("user1", true)
|
||||
.getNumRunnableApps());
|
||||
assertEquals(0, scheduler.getQueueManager().getLeafQueue("default", true)
|
||||
.getNumRunnableApps());
|
||||
assertEquals("root.user1", resourceManager.getRMContext().getRMApps()
|
||||
.get(attId2.getApplicationId()).getQueue());
|
||||
|
||||
ApplicationAttemptId attId3 = createAppAttemptId(3, 1);
|
||||
createApplicationWithAMResource(attId3, "default", "user1", null);
|
||||
assertEquals(3, scheduler.getQueueManager().getLeafQueue("user1", true)
|
||||
.getNumRunnableApps());
|
||||
assertEquals(0, scheduler.getQueueManager().getLeafQueue("default", true)
|
||||
.getNumRunnableApps());
|
||||
assertEquals("root.user1", resourceManager.getRMContext().getRMApps()
|
||||
.get(attId3.getApplicationId()).getQueue());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user