use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue in project hadoop by apache.
the class TestAppSchedulingInfo method testBacklistChanged.
@Test
public void testBacklistChanged() {
ApplicationId appIdImpl = ApplicationId.newInstance(0, 1);
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appIdImpl, 1);
FSLeafQueue queue = mock(FSLeafQueue.class);
doReturn("test").when(queue).getQueueName();
AppSchedulingInfo appSchedulingInfo = new AppSchedulingInfo(appAttemptId, "test", queue, null, 0, new ResourceUsage());
appSchedulingInfo.updatePlacesBlacklistedByApp(new ArrayList<String>(), new ArrayList<String>());
Assert.assertFalse(appSchedulingInfo.getAndResetBlacklistChanged());
ArrayList<String> blacklistAdditions = new ArrayList<String>();
blacklistAdditions.add("node1");
blacklistAdditions.add("node2");
appSchedulingInfo.updatePlacesBlacklistedByApp(blacklistAdditions, new ArrayList<String>());
Assert.assertTrue(appSchedulingInfo.getAndResetBlacklistChanged());
blacklistAdditions.clear();
blacklistAdditions.add("node1");
appSchedulingInfo.updatePlacesBlacklistedByApp(blacklistAdditions, new ArrayList<String>());
Assert.assertFalse(appSchedulingInfo.getAndResetBlacklistChanged());
ArrayList<String> blacklistRemovals = new ArrayList<String>();
blacklistRemovals.add("node1");
appSchedulingInfo.updatePlacesBlacklistedByApp(new ArrayList<String>(), blacklistRemovals);
appSchedulingInfo.updatePlacesBlacklistedByApp(new ArrayList<String>(), blacklistRemovals);
Assert.assertTrue(appSchedulingInfo.getAndResetBlacklistChanged());
appSchedulingInfo.updatePlacesBlacklistedByApp(new ArrayList<String>(), blacklistRemovals);
Assert.assertFalse(appSchedulingInfo.getAndResetBlacklistChanged());
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue in project hadoop by apache.
the class TestFairSchedulerPlanFollower method assertReservationQueueExists.
@Override
protected void assertReservationQueueExists(ReservationId r, double expectedCapacity, double expectedMaxCapacity) {
FSLeafQueue q = fs.getQueueManager().getLeafQueue(plan.getQueueName() + "" + "." + r, false);
assertNotNull(q);
// For now we are setting both to same weight
Assert.assertEquals(expectedCapacity, q.getWeights().getWeight(ResourceType.MEMORY), 0.01);
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue in project hadoop by apache.
the class FairSchedulerQueueInfo method getChildQueues.
protected FairSchedulerQueueInfoList getChildQueues(FSQueue queue, FairScheduler scheduler) {
// Return null to omit 'childQueues' field from the return value of
// REST API if it is empty. We omit the field to keep the consistency
// with CapacitySchedulerQueueInfo, which omits 'queues' field if empty.
Collection<FSQueue> children = queue.getChildQueues();
if (children.isEmpty()) {
return null;
}
FairSchedulerQueueInfoList list = new FairSchedulerQueueInfoList();
for (FSQueue child : children) {
if (child instanceof FSLeafQueue) {
list.addToQueueInfoList(new FairSchedulerLeafQueueInfo((FSLeafQueue) child, scheduler));
} else {
list.addToQueueInfoList(new FairSchedulerQueueInfo(child, scheduler));
}
}
return list;
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue in project hadoop by apache.
the class FairSchedulerPlanFollower method getReservationQueueResourceIfExists.
@Override
protected Resource getReservationQueueResourceIfExists(Plan plan, ReservationId reservationId) {
String reservationQueueName = getReservationQueueName(plan.getQueueName(), reservationId.toString());
FSLeafQueue reservationQueue = fs.getQueueManager().getLeafQueue(reservationQueueName, false);
Resource reservationResource = null;
if (reservationQueue != null) {
reservationResource = reservationQueue.getSteadyFairShare();
}
return reservationResource;
}
Aggregations