YARN-1236. FairScheduler setting queue name in RMApp is not working. (Sandy Ryza)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1529034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanford Ryza 2013-10-03 23:29:39 +00:00
parent 1608d8b527
commit ac2cdb5f65
3 changed files with 18 additions and 2 deletions

View File

@ -141,6 +141,9 @@ Release 2.1.2 - UNRELEASED
additions of authenticated filters there by causing kerberos replay errors.
(Omkar Vinit Joshi via vinodkv)
YARN-1236. FairScheduler setting queue name in RMApp is not working.
(Sandy Ryza)
Release 2.1.1-beta - 2013-09-23
INCOMPATIBLE CHANGES

View File

@ -634,7 +634,8 @@ public class FairScheduler implements ResourceScheduler {
return;
}
RMApp rmApp = rmContext.getRMApps().get(applicationAttemptId);
RMApp rmApp = rmContext.getRMApps().get(
applicationAttemptId.getApplicationId());
FSLeafQueue queue = assignToQueue(rmApp, queueName, user);
FSSchedulerApp schedulerApp =
@ -686,6 +687,8 @@ public class FairScheduler implements ResourceScheduler {
if (rmApp != null) {
rmApp.setQueue(queue.getName());
} else {
LOG.warn("Couldn't find RM app to set queue name on");
}
return queue;

View File

@ -67,6 +67,7 @@ import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.server.resourcemanager.ApplicationMasterService;
import org.apache.hadoop.yarn.server.resourcemanager.MockNodes;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.MockRMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
@ -603,13 +604,22 @@ public class TestFairScheduler {
Configuration conf = createConfiguration();
conf.set(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, "true");
scheduler.reinitialize(conf, resourceManager.getRMContext());
RMContext rmContext = resourceManager.getRMContext();
Map<ApplicationId, RMApp> appsMap = rmContext.getRMApps();
ApplicationAttemptId appAttemptId = createAppAttemptId(1, 1);
RMApp rmApp = new RMAppImpl(appAttemptId.getApplicationId(), rmContext, conf,
null, null, null, ApplicationSubmissionContext.newInstance(null, null,
null, null, null, false, false, 0, null, null), null, null, 0, null);
appsMap.put(appAttemptId.getApplicationId(), rmApp);
AppAddedSchedulerEvent appAddedEvent = new AppAddedSchedulerEvent(
createAppAttemptId(1, 1), "default", "user1");
appAttemptId, "default", "user1");
scheduler.handle(appAddedEvent);
assertEquals(1, scheduler.getQueueManager().getLeafQueue("user1", true)
.getAppSchedulables().size());
assertEquals(0, scheduler.getQueueManager().getLeafQueue("default", true)
.getAppSchedulables().size());
assertEquals("root.user1", rmApp.getQueue());
conf.set(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, "false");
scheduler.reinitialize(conf, resourceManager.getRMContext());