Java Code Examples for org.apache.hadoop.yarn.server.resourcemanager.ResourceManager#start()

The following examples show how to use org.apache.hadoop.yarn.server.resourcemanager.ResourceManager#start() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   File: TestYarnClient.java    License: Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 2
Source Project: hadoop   File: SLSRunner.java    License: Apache License 2.0 5 votes vote down vote up
private void startRM() throws IOException, ClassNotFoundException {
  Configuration rmConf = new YarnConfiguration();
  String schedulerClass = rmConf.get(YarnConfiguration.RM_SCHEDULER);
  rmConf.set(SLSConfiguration.RM_SCHEDULER, schedulerClass);
  rmConf.set(YarnConfiguration.RM_SCHEDULER,
          ResourceSchedulerWrapper.class.getName());
  rmConf.set(SLSConfiguration.METRICS_OUTPUT_DIR, metricsOutputDir);
  rm = new ResourceManager();
  rm.init(rmConf);
  rm.start();
}
 
Example 3
Source Project: hadoop   File: TestNMSimulator.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.sls.scheduler.ResourceSchedulerWrapper");
  conf.set(SLSConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler");
  conf.setBoolean(SLSConfiguration.METRICS_SWITCH, false);
  rm = new ResourceManager();
  rm.init(conf);
  rm.start();
}
 
Example 4
Source Project: hadoop   File: TestAMSimulator.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.sls.scheduler.ResourceSchedulerWrapper");
  conf.set(SLSConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler");
  conf.setBoolean(SLSConfiguration.METRICS_SWITCH, false);
  rm = new ResourceManager();
  rm.init(conf);
  rm.start();
}
 
Example 5
Source Project: big-c   File: TestYarnClient.java    License: Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 6
Source Project: big-c   File: SLSRunner.java    License: Apache License 2.0 5 votes vote down vote up
private void startRM() throws IOException, ClassNotFoundException {
  Configuration rmConf = new YarnConfiguration();
  String schedulerClass = rmConf.get(YarnConfiguration.RM_SCHEDULER);
  rmConf.set(SLSConfiguration.RM_SCHEDULER, schedulerClass);
  rmConf.set(YarnConfiguration.RM_SCHEDULER,
          ResourceSchedulerWrapper.class.getName());
  rmConf.set(SLSConfiguration.METRICS_OUTPUT_DIR, metricsOutputDir);
  rm = new ResourceManager();
  rm.init(rmConf);
  rm.start();
}
 
Example 7
Source Project: big-c   File: TestNMSimulator.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.sls.scheduler.ResourceSchedulerWrapper");
  conf.set(SLSConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler");
  conf.setBoolean(SLSConfiguration.METRICS_SWITCH, false);
  rm = new ResourceManager();
  rm.init(conf);
  rm.start();
}
 
Example 8
Source Project: big-c   File: TestAMSimulator.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.sls.scheduler.ResourceSchedulerWrapper");
  conf.set(SLSConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler");
  conf.setBoolean(SLSConfiguration.METRICS_SWITCH, false);
  rm = new ResourceManager();
  rm.init(conf);
  rm.start();
}
 
Example 9
Source Project: hadoop   File: TestZKRMStateStore.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void testFencing() throws Exception {
  StateChangeRequestInfo req = new StateChangeRequestInfo(
      HAServiceProtocol.RequestSource.REQUEST_BY_USER);

  Configuration conf1 = createHARMConf("rm1,rm2", "rm1", 1234);
  conf1.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
  ResourceManager rm1 = new ResourceManager();
  rm1.init(conf1);
  rm1.start();
  rm1.getRMContext().getRMAdminService().transitionToActive(req);
  assertEquals("RM with ZKStore didn't start",
      Service.STATE.STARTED, rm1.getServiceState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm1.getRMContext().getRMAdminService().getServiceStatus().getState());

  Configuration conf2 = createHARMConf("rm1,rm2", "rm2", 5678);
  conf2.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
  ResourceManager rm2 = new ResourceManager();
  rm2.init(conf2);
  rm2.start();
  rm2.getRMContext().getRMAdminService().transitionToActive(req);
  assertEquals("RM with ZKStore didn't start",
      Service.STATE.STARTED, rm2.getServiceState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm2.getRMContext().getRMAdminService().getServiceStatus().getState());

  for (int i = 0; i < ZK_TIMEOUT_MS / 50; i++) {
    if (HAServiceProtocol.HAServiceState.ACTIVE ==
        rm1.getRMContext().getRMAdminService().getServiceStatus().getState()) {
      Thread.sleep(100);
    }
  }
  assertEquals("RM should have been fenced",
      HAServiceProtocol.HAServiceState.STANDBY,
      rm1.getRMContext().getRMAdminService().getServiceStatus().getState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm2.getRMContext().getRMAdminService().getServiceStatus().getState());
}
 
Example 10
Source Project: big-c   File: TestZKRMStateStore.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void testFencing() throws Exception {
  StateChangeRequestInfo req = new StateChangeRequestInfo(
      HAServiceProtocol.RequestSource.REQUEST_BY_USER);

  Configuration conf1 = createHARMConf("rm1,rm2", "rm1", 1234);
  conf1.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
  ResourceManager rm1 = new ResourceManager();
  rm1.init(conf1);
  rm1.start();
  rm1.getRMContext().getRMAdminService().transitionToActive(req);
  assertEquals("RM with ZKStore didn't start",
      Service.STATE.STARTED, rm1.getServiceState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm1.getRMContext().getRMAdminService().getServiceStatus().getState());

  Configuration conf2 = createHARMConf("rm1,rm2", "rm2", 5678);
  conf2.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
  ResourceManager rm2 = new ResourceManager();
  rm2.init(conf2);
  rm2.start();
  rm2.getRMContext().getRMAdminService().transitionToActive(req);
  assertEquals("RM with ZKStore didn't start",
      Service.STATE.STARTED, rm2.getServiceState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm2.getRMContext().getRMAdminService().getServiceStatus().getState());

  for (int i = 0; i < ZK_TIMEOUT_MS / 50; i++) {
    if (HAServiceProtocol.HAServiceState.ACTIVE ==
        rm1.getRMContext().getRMAdminService().getServiceStatus().getState()) {
      Thread.sleep(100);
    }
  }
  assertEquals("RM should have been fenced",
      HAServiceProtocol.HAServiceState.STANDBY,
      rm1.getRMContext().getRMAdminService().getServiceStatus().getState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm2.getRMContext().getRMAdminService().getServiceStatus().getState());
}