YARN-7389. Make TestResourceManager Scheduler agnostic. (Robert Kanter via Haibo Chen)

This commit is contained in:
Haibo Chen 2017-10-24 22:17:56 -07:00
parent 17cd8d0c17
commit d7f3737f3b
1 changed files with 2 additions and 7 deletions

View File

@ -39,7 +39,7 @@ import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptRemovedSchedulerEvent; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptRemovedSchedulerEvent;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent;
@ -58,8 +58,6 @@ public class TestResourceManager {
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
Configuration conf = new YarnConfiguration(); Configuration conf = new YarnConfiguration();
conf.set(YarnConfiguration.RM_SCHEDULER,
CapacityScheduler.class.getCanonicalName());
UserGroupInformation.setConfiguration(conf); UserGroupInformation.setConfiguration(conf);
resourceManager = new ResourceManager(); resourceManager = new ResourceManager();
resourceManager.init(conf); resourceManager.init(conf);
@ -133,6 +131,7 @@ public class TestResourceManager {
// Send a heartbeat to kick the tires on the Scheduler // Send a heartbeat to kick the tires on the Scheduler
nodeUpdate(nm1); nodeUpdate(nm1);
((AbstractYarnScheduler)resourceManager.getResourceScheduler()).update();
// Get allocations from the scheduler // Get allocations from the scheduler
application.schedule(); application.schedule();
@ -262,8 +261,6 @@ public class TestResourceManager {
} }
}; };
Configuration conf = new YarnConfiguration(); Configuration conf = new YarnConfiguration();
conf.set(YarnConfiguration.RM_SCHEDULER,
CapacityScheduler.class.getCanonicalName());
conf.set(filterInitializerConfKey, filterInitializer); conf.set(filterInitializerConfKey, filterInitializer);
conf.set("hadoop.security.authentication", "kerberos"); conf.set("hadoop.security.authentication", "kerberos");
conf.set("hadoop.http.authentication.type", "kerberos"); conf.set("hadoop.http.authentication.type", "kerberos");
@ -298,8 +295,6 @@ public class TestResourceManager {
for (String filterInitializer : simpleFilterInitializers) { for (String filterInitializer : simpleFilterInitializers) {
resourceManager = new ResourceManager(); resourceManager = new ResourceManager();
Configuration conf = new YarnConfiguration(); Configuration conf = new YarnConfiguration();
conf.set(YarnConfiguration.RM_SCHEDULER,
CapacityScheduler.class.getCanonicalName());
conf.set(filterInitializerConfKey, filterInitializer); conf.set(filterInitializerConfKey, filterInitializer);
try { try {
UserGroupInformation.setConfiguration(conf); UserGroupInformation.setConfiguration(conf);