use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler in project hadoop by apache.
the class TestRMWebServices method checkSchedulerLogFileAndCleanup.
private void checkSchedulerLogFileAndCleanup() {
String targetFile;
ResourceScheduler scheduler = rm.getResourceScheduler();
if (scheduler instanceof FairScheduler) {
targetFile = "yarn-fair-scheduler-debug.log";
} else if (scheduler instanceof CapacityScheduler) {
targetFile = "yarn-capacity-scheduler-debug.log";
} else {
targetFile = "yarn-scheduler-debug.log";
}
File logFile = new File(System.getProperty("yarn.log.dir"), targetFile);
assertTrue("scheduler log file doesn't exist", logFile.exists());
FileUtils.deleteQuietly(logFile);
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler in project hadoop by apache.
the class TestRMWebServicesAppsModification method testSingleAppKillUnauthorized.
@Test(timeout = 60000)
public void testSingleAppKillUnauthorized() throws Exception {
boolean isCapacityScheduler = rm.getResourceScheduler() instanceof CapacityScheduler;
boolean isFairScheduler = rm.getResourceScheduler() instanceof FairScheduler;
assumeTrue("This test is only supported on Capacity and Fair Scheduler", isCapacityScheduler || isFairScheduler);
// FairScheduler use ALLOCATION_FILE to configure ACL
if (isCapacityScheduler) {
// default root queue allows anyone to have admin acl
CapacitySchedulerConfiguration csconf = new CapacitySchedulerConfiguration();
csconf.setAcl("root", QueueACL.ADMINISTER_QUEUE, "someuser");
csconf.setAcl("root.default", QueueACL.ADMINISTER_QUEUE, "someuser");
rm.getResourceScheduler().reinitialize(csconf, rm.getRMContext());
}
rm.start();
MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
String[] mediaTypes = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML };
for (String mediaType : mediaTypes) {
RMApp app = rm.submitApp(CONTAINER_MB, "test", "someuser");
amNodeManager.nodeHeartbeat(true);
ClientResponse response = this.constructWebResource("apps", app.getApplicationId().toString(), "state").accept(mediaType).get(ClientResponse.class);
AppState info = response.getEntity(AppState.class);
info.setState(YarnApplicationState.KILLED.toString());
response = this.constructWebResource("apps", app.getApplicationId().toString(), "state").accept(mediaType).entity(info, MediaType.APPLICATION_XML).put(ClientResponse.class);
validateResponseStatus(response, Status.FORBIDDEN);
}
rm.stop();
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler in project hadoop by apache.
the class RmController method scheduler.
public void scheduler() {
// limit applications to those in states relevant to scheduling
set(YarnWebParams.APP_STATE, StringHelper.cjoin(YarnApplicationState.NEW.toString(), YarnApplicationState.NEW_SAVING.toString(), YarnApplicationState.SUBMITTED.toString(), YarnApplicationState.ACCEPTED.toString(), YarnApplicationState.RUNNING.toString()));
ResourceManager rm = getInstance(ResourceManager.class);
ResourceScheduler rs = rm.getResourceScheduler();
if (rs == null || rs instanceof CapacityScheduler) {
setTitle("Capacity Scheduler");
render(CapacitySchedulerPage.class);
return;
}
if (rs instanceof FairScheduler) {
setTitle("Fair Scheduler");
render(FairSchedulerPage.class);
return;
}
setTitle("Default Scheduler");
render(DefaultSchedulerPage.class);
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler in project hadoop by apache.
the class ReservationSystemTestUtil method setupFairScheduler.
public static FairScheduler setupFairScheduler(RMContext rmContext, Configuration conf, int numContainers) throws IOException {
FairScheduler scheduler = new FairScheduler();
scheduler.setRMContext(rmContext);
when(rmContext.getScheduler()).thenReturn(scheduler);
scheduler.init(conf);
scheduler.start();
scheduler.reinitialize(conf, rmContext);
Resource resource = ReservationSystemTestUtil.calculateClusterResource(numContainers);
RMNode node1 = MockNodes.newNodeInfo(1, resource, 1, "127.0.0.1");
NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
scheduler.handle(nodeEvent1);
return scheduler;
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler in project hadoop by apache.
the class TestFairSchedulerQueueInfo method testEmptyChildQueues.
@Test
public void testEmptyChildQueues() throws Exception {
FairSchedulerConfiguration conf = new FairSchedulerConfiguration();
FairScheduler scheduler = mock(FairScheduler.class);
AllocationConfiguration allocConf = new AllocationConfiguration(conf);
when(scheduler.getAllocationConfiguration()).thenReturn(allocConf);
when(scheduler.getConf()).thenReturn(conf);
when(scheduler.getClusterResource()).thenReturn(Resource.newInstance(1, 1));
SystemClock clock = SystemClock.getInstance();
when(scheduler.getClock()).thenReturn(clock);
QueueManager queueManager = new QueueManager(scheduler);
queueManager.initialize(conf);
FSQueue testQueue = queueManager.getLeafQueue("test", true);
FairSchedulerQueueInfo queueInfo = new FairSchedulerQueueInfo(testQueue, scheduler);
Collection<FairSchedulerQueueInfo> childQueues = queueInfo.getChildQueues();
Assert.assertNotNull(childQueues);
Assert.assertEquals("Child QueueInfo was not empty", 0, childQueues.size());
}
Aggregations