Search in sources :

Example 6 with ResourceManager

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

the class TestGetGroups method setUpResourceManager.

@BeforeClass
public static void setUpResourceManager() throws InterruptedException {
    conf = new YarnConfiguration();
    resourceManager = new ResourceManager() {

        @Override
        protected void doSecureLogin() throws IOException {
        }

        ;
    };
    // a reliable way to wait for resource manager to start
    CountDownLatch rmStartedSignal = new CountDownLatch(1);
    ServiceStateChangeListener rmStateChangeListener = new ServiceStateChangeListener() {

        @Override
        public void stateChanged(Service service) {
            if (service.getServiceState() == STATE.STARTED) {
                rmStartedSignal.countDown();
            }
        }
    };
    resourceManager.registerServiceListener(rmStateChangeListener);
    resourceManager.init(conf);
    new Thread() {

        public void run() {
            resourceManager.start();
        }

        ;
    }.start();
    boolean rmStarted = rmStartedSignal.await(60000L, TimeUnit.MILLISECONDS);
    Assert.assertTrue("ResourceManager failed to start up.", rmStarted);
    LOG.info("ResourceManager RMAdmin address: " + conf.get(YarnConfiguration.RM_ADMIN_ADDRESS));
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ServiceStateChangeListener(org.apache.hadoop.service.ServiceStateChangeListener) Service(org.apache.hadoop.service.Service) ResourceManager(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager) IOException(java.io.IOException) CountDownLatch(java.util.concurrent.CountDownLatch) BeforeClass(org.junit.BeforeClass)

Example 7 with ResourceManager

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

the class TestYarnClient method testClientStop.

@Test
public void testClientStop() {
    Configuration conf = new Configuration();
    ResourceManager rm = new ResourceManager();
    rm.init(conf);
    rm.start();
    YarnClient client = YarnClient.createYarnClient();
    client.init(conf);
    client.start();
    client.stop();
    rm.stop();
}
Also used : CapacitySchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ResourceManager(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager) YarnClient(org.apache.hadoop.yarn.client.api.YarnClient) Test(org.junit.Test)

Example 8 with ResourceManager

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

the class AboutBlock method render.

@Override
protected void render(Block html) {
    html._(MetricsOverviewTable.class);
    ResourceManager rm = getInstance(ResourceManager.class);
    ClusterInfo cinfo = new ClusterInfo(rm);
    info("Cluster overview")._("Cluster ID:", cinfo.getClusterId())._("ResourceManager state:", cinfo.getState())._("ResourceManager HA state:", cinfo.getHAState())._("ResourceManager HA zookeeper connection state:", cinfo.getHAZookeeperConnectionState())._("ResourceManager RMStateStore:", cinfo.getRMStateStore())._("ResourceManager started on:", Times.format(cinfo.getStartedOn()))._("ResourceManager version:", cinfo.getRMBuildVersion() + " on " + cinfo.getRMVersionBuiltOn())._("Hadoop version:", cinfo.getHadoopBuildVersion() + " on " + cinfo.getHadoopVersionBuiltOn());
    html._(InfoBlock.class);
}
Also used : ClusterInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterInfo) ResourceManager(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager)

Example 9 with ResourceManager

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

the class TestSchedulingMonitor method testRMStarts.

@Test(timeout = 10000)
public void testRMStarts() {
    Configuration conf = new YarnConfiguration();
    conf.setBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, true);
    conf.set(YarnConfiguration.RM_SCHEDULER_MONITOR_POLICIES, ProportionalCapacityPreemptionPolicy.class.getCanonicalName());
    ResourceManager rm = new MockRM();
    try {
        rm.init(conf);
    } catch (Exception e) {
        fail("ResourceManager does not start when " + YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS + " is set to true");
    }
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) MockRM(org.apache.hadoop.yarn.server.resourcemanager.MockRM) ResourceManager(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager) ProportionalCapacityPreemptionPolicy(org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.ProportionalCapacityPreemptionPolicy) Test(org.junit.Test)

Example 10 with ResourceManager

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

the class TestMemoryRMStateStore method testNotifyStoreOperationFailed.

@Test
public void testNotifyStoreOperationFailed() throws Exception {
    RMStateStore store = new MemoryRMStateStore() {

        @Override
        public synchronized void removeRMDelegationTokenState(RMDelegationTokenIdentifier rmDTIdentifier) throws Exception {
            throw new Exception("testNotifyStoreOperationFailed");
        }
    };
    Configuration conf = new Configuration();
    conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
    store.init(conf);
    ResourceManager mockRM = mock(ResourceManager.class);
    store.setResourceManager(mockRM);
    RMDelegationTokenIdentifier mockTokenId = mock(RMDelegationTokenIdentifier.class);
    store.removeRMDelegationToken(mockTokenId);
    assertTrue("RMStateStore should have been in fenced state", store.isFencedState());
    store = new MemoryRMStateStore() {

        @Override
        public synchronized void removeRMDelegationToken(RMDelegationTokenIdentifier rmDTIdentifier) {
            notifyStoreOperationFailed(new Exception("testNotifyStoreOperationFailed"));
        }
    };
    store.init(conf);
    store.setResourceManager(mockRM);
    store.removeRMDelegationToken(mockTokenId);
    assertTrue("RMStateStore should have been in fenced state", store.isFencedState());
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) RMDelegationTokenIdentifier(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier) ResourceManager(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager) Test(org.junit.Test)

Aggregations

ResourceManager (org.apache.hadoop.yarn.server.resourcemanager.ResourceManager)36 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)18 Test (org.junit.Test)17 Configuration (org.apache.hadoop.conf.Configuration)10 RMContext (org.apache.hadoop.yarn.server.resourcemanager.RMContext)10 IOException (java.io.IOException)7 ResourceScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler)6 Binder (com.google.inject.Binder)5 Injector (com.google.inject.Injector)5 Module (com.google.inject.Module)5 RMNodeLabelsManager (org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager)5 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)4 AsyncDispatcher (org.apache.hadoop.yarn.event.AsyncDispatcher)4 ClientRMService (org.apache.hadoop.yarn.server.resourcemanager.ClientRMService)4 MockRM (org.apache.hadoop.yarn.server.resourcemanager.MockRM)4 Service (org.apache.hadoop.service.Service)3 Before (org.junit.Before)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2