Search in sources :

Example 61 with YarnConfiguration

use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.

the class ProtocolHATestBase method setup.

@Before
public void setup() throws IOException {
    failoverThread = null;
    keepRunning = true;
    conf = new YarnConfiguration();
    conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
    conf.setInt(YarnConfiguration.CLIENT_FAILOVER_MAX_ATTEMPTS, 5);
    conf.set(YarnConfiguration.RM_HA_IDS, RM1_NODE_ID + "," + RM2_NODE_ID);
    HATestUtil.setRpcAddressForRM(RM1_NODE_ID, RM1_PORT_BASE, conf);
    HATestUtil.setRpcAddressForRM(RM2_NODE_ID, RM2_PORT_BASE, conf);
    conf.setLong(YarnConfiguration.CLIENT_FAILOVER_SLEEPTIME_BASE_MS, 100L);
    conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS, true);
    conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_USE_RPC, true);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Before(org.junit.Before)

Example 62 with YarnConfiguration

use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.

the class TestRMFailover method setup.

@Before
public void setup() throws IOException {
    fakeAppId = ApplicationId.newInstance(System.currentTimeMillis(), 0);
    conf = new YarnConfiguration();
    conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
    conf.set(YarnConfiguration.RM_HA_IDS, RM1_NODE_ID + "," + RM2_NODE_ID);
    HATestUtil.setRpcAddressForRM(RM1_NODE_ID, RM1_PORT_BASE, conf);
    HATestUtil.setRpcAddressForRM(RM2_NODE_ID, RM2_PORT_BASE, conf);
    conf.setLong(YarnConfiguration.CLIENT_FAILOVER_SLEEPTIME_BASE_MS, 100L);
    conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS, true);
    conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_USE_RPC, true);
    cluster = new MiniYARNCluster(TestRMFailover.class.getName(), 2, 1, 1, 1);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) MiniYARNCluster(org.apache.hadoop.yarn.server.MiniYARNCluster) Before(org.junit.Before)

Example 63 with YarnConfiguration

use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.

the class TestResourceManagerAdministrationProtocolPBClientImpl method setUpResourceManager.

/**
   * Start resource manager server
   */
@BeforeClass
public static void setUpResourceManager() throws IOException, InterruptedException {
    Configuration.addDefaultResource("config-with-security.xml");
    Configuration configuration = new YarnConfiguration();
    resourceManager = new ResourceManager() {

        @Override
        protected void doSecureLogin() throws IOException {
        }
    };
    // a reliable way to wait for resource manager to fully start
    final 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(configuration);
    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: " + configuration.get(YarnConfiguration.RM_ADMIN_ADDRESS));
    client = new ResourceManagerAdministrationProtocolPBClientImpl(1L, getProtocolAddress(configuration), configuration);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) 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) ResourceManagerAdministrationProtocolPBClientImpl(org.apache.hadoop.yarn.server.api.impl.pb.client.ResourceManagerAdministrationProtocolPBClientImpl) BeforeClass(org.junit.BeforeClass)

Example 64 with YarnConfiguration

use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.

the class TestApplicationClientProtocolOnHA method initiate.

@Before
public void initiate() throws Exception {
    startHACluster(1, true, false, false);
    Configuration conf = new YarnConfiguration(this.conf);
    client = createAndStartYarnClient(conf);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Before(org.junit.Before)

Example 65 with YarnConfiguration

use of org.apache.hadoop.yarn.conf.YarnConfiguration 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)

Aggregations

YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)479 Test (org.junit.Test)300 Configuration (org.apache.hadoop.conf.Configuration)181 Before (org.junit.Before)65 IOException (java.io.IOException)63 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)51 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)48 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)47 Path (org.apache.hadoop.fs.Path)41 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)41 MockRM (org.apache.hadoop.yarn.server.resourcemanager.MockRM)38 File (java.io.File)37 ArrayList (java.util.ArrayList)28 HashMap (java.util.HashMap)27 RMContainerTokenSecretManager (org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager)27 MockNM (org.apache.hadoop.yarn.server.resourcemanager.MockNM)26 YarnClient (org.apache.hadoop.yarn.client.api.YarnClient)25 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)25 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)24 RMContextImpl (org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl)24