Search in sources :

Example 1 with FSLeafQueue

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());
}
Also used : FSLeafQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue) ArrayList(java.util.ArrayList) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) Test(org.junit.Test)

Example 2 with FSLeafQueue

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);
}
Also used : FSLeafQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue)

Example 3 with FSLeafQueue

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;
}
Also used : FSLeafQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue) FSQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue)

Example 4 with FSLeafQueue

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;
}
Also used : FSLeafQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue) Resource(org.apache.hadoop.yarn.api.records.Resource)

Aggregations

FSLeafQueue (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue)4 ArrayList (java.util.ArrayList)1 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 Resource (org.apache.hadoop.yarn.api.records.Resource)1 FSQueue (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue)1 Test (org.junit.Test)1