Search in sources :

Example 1 with SchedulingMonitor

use of org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingMonitor in project hadoop by apache.

the class CapacitySchedulerPreemptionTestBase method getSchedulingEditPolicy.

SchedulingEditPolicy getSchedulingEditPolicy(MockRM rm) {
    ResourceManager.RMActiveServices activeServices = rm.getRMActiveService();
    SchedulingMonitor mon = null;
    for (Service service : activeServices.getServices()) {
        if (service instanceof SchedulingMonitor) {
            mon = (SchedulingMonitor) service;
            break;
        }
    }
    if (mon != null) {
        return mon.getSchedulingEditPolicy();
    }
    return null;
}
Also used : SchedulingMonitor(org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingMonitor) Service(org.apache.hadoop.service.Service) ResourceManager(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager)

Example 2 with SchedulingMonitor

use of org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingMonitor in project hadoop by apache.

the class TestProportionalCapacityPreemptionPolicy method testPolicyInitializeAfterSchedulerInitialized.

@Test
public void testPolicyInitializeAfterSchedulerInitialized() {
    @SuppressWarnings("resource") MockRM rm = new MockRM(conf);
    rm.init(conf);
    // after scheduler got initialized
    for (Service service : rm.getRMActiveService().getServices()) {
        if (service instanceof SchedulingMonitor) {
            ProportionalCapacityPreemptionPolicy policy = (ProportionalCapacityPreemptionPolicy) ((SchedulingMonitor) service).getSchedulingEditPolicy();
            assertNotNull(policy.getResourceCalculator());
            return;
        }
    }
    fail("Failed to find SchedulingMonitor service, please check what happened");
}
Also used : SchedulingMonitor(org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingMonitor) Service(org.apache.hadoop.service.Service) MockRM(org.apache.hadoop.yarn.server.resourcemanager.MockRM) Test(org.junit.Test)

Aggregations

Service (org.apache.hadoop.service.Service)2 SchedulingMonitor (org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingMonitor)2 MockRM (org.apache.hadoop.yarn.server.resourcemanager.MockRM)1 ResourceManager (org.apache.hadoop.yarn.server.resourcemanager.ResourceManager)1 Test (org.junit.Test)1