• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MemoryRMStateStore类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore的典型用法代码示例。如果您正苦于以下问题:Java MemoryRMStateStore类的具体用法?Java MemoryRMStateStore怎么用?Java MemoryRMStateStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MemoryRMStateStore类属于org.apache.hadoop.yarn.server.resourcemanager.recovery包,在下文中一共展示了MemoryRMStateStore类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: finishApplicationMaster

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
private void finishApplicationMaster(RMApp rmApp, MockRM rm, MockNM nm,
    MockAM am, FinishApplicationMasterRequest req) throws Exception {
  RMState rmState =
      ((MemoryRMStateStore) rm.getRMContext().getStateStore()).getState();
  Map<ApplicationId, ApplicationStateData> rmAppState =
      rmState.getApplicationState();
  am.unregisterAppAttempt(req,true);
  am.waitForState(RMAppAttemptState.FINISHING);
  nm.nodeHeartbeat(am.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  am.waitForState(RMAppAttemptState.FINISHED);
  rm.waitForState(rmApp.getApplicationId(), RMAppState.FINISHED);
  // check that app/attempt is saved with the final state
  ApplicationStateData appState = rmAppState.get(rmApp.getApplicationId());
  Assert
    .assertEquals(RMAppState.FINISHED, appState.getState());
  Assert.assertEquals(RMAppAttemptState.FINISHED,
    appState.getAttempt(am.getApplicationAttemptId()).getState());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestRMRestart.java


示例2: testRMShutdown

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test (timeout = 10000)
public void testRMShutdown() throws Exception {
  MemoryRMStateStore memStore = new MemoryRMStateStore() {
    @Override
    public synchronized void checkVersion()
        throws Exception {
      throw new Exception("Invalid version.");
    }
  };
  // start RM
  memStore.init(conf);
  MockRM rm1 = null;
  try {
    rm1 = createMockRM(conf, memStore);
    rm1.start();
    Assert.fail();
  } catch (Exception e) {
    Assert.assertTrue(e.getMessage().contains("Invalid version."));
  }
  Assert.assertTrue(rm1.getServiceState() == STATE.STOPPED);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestRMRestart.java


示例3: testAppFailToValidateResourceRequestOnRecovery

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
/**
 * Test validateAndCreateResourceRequest fails on recovery, app should ignore
 * this Exception and continue
 */
@Test (timeout = 30000)
public void testAppFailToValidateResourceRequestOnRecovery() throws Exception{
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 8192, rm1.getResourceTrackerService());
  nm1.registerNode();
  RMApp app1 = rm1.submitApp(200);
  MockAM am1 = MockRM.launchAndRegisterAM(app1, rm1, nm1);

  // Change the config so that validateAndCreateResourceRequest throws
  // exception on recovery
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 50);
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, 100);

  rm2 = new MockRM(conf, memStore);
  nm1.setResourceTrackerService(rm2.getResourceTrackerService());
  rm2.start();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestWorkPreservingRMRestart.java


示例4: finishApplicationMaster

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
private void finishApplicationMaster(RMApp rmApp, MockRM rm, MockNM nm,
    MockAM am, FinishApplicationMasterRequest req) throws Exception {
  RMState rmState =
      ((MemoryRMStateStore) rm.getRMContext().getStateStore()).getState();
  Map<ApplicationId, ApplicationState> rmAppState =
      rmState.getApplicationState();
  am.unregisterAppAttempt(req,true);
  am.waitForState(RMAppAttemptState.FINISHING);
  nm.nodeHeartbeat(am.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  am.waitForState(RMAppAttemptState.FINISHED);
  rm.waitForState(rmApp.getApplicationId(), RMAppState.FINISHED);
  // check that app/attempt is saved with the final state
  ApplicationState appState = rmAppState.get(rmApp.getApplicationId());
  Assert
    .assertEquals(RMAppState.FINISHED, appState.getState());
  Assert.assertEquals(RMAppAttemptState.FINISHED,
    appState.getAttempt(am.getApplicationAttemptId()).getState());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:19,代码来源:TestRMRestart.java


示例5: testRMShutdown

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Ignore //the test need to be reimplemented to work with the distributed RT
@Test (timeout = 10000)
public void testRMShutdown() throws Exception {
  conf.set(YarnConfiguration.RM_STORE, MemoryRMStateStore.class.getName());
  MemoryRMStateStore memStore = new MemoryRMStateStore() {
    @Override
    public synchronized void checkVersion()
        throws Exception {
      throw new Exception("Invalid version.");
    }
  };
  // start RM
  memStore.init(conf);
  MockRM rm1 = null;
  try {
    rm1 = createMockRM(conf, memStore);
    Assume.assumeFalse(rm1.getResourceScheduler() instanceof FairScheduler);
    rm1.start();
    Assert.fail();
  } catch (Exception e) {
    Assert.assertTrue(e.getMessage().contains("Invalid version."));
  }
  Assert.assertTrue(rm1.getServiceState() == STATE.STOPPED);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:25,代码来源:TestRMRestart.java


示例6: startRM

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
private MockRM startRM(YarnConfiguration conf) {

    MemoryRMStateStore memStore = new MemoryRMStateStore();
    memStore.init(conf);

    MockRM rm1 = new MockRM(conf, memStore) {
      @Override
      protected EventHandler<SchedulerEvent> createSchedulerEventDispatcher() {
        return new SchedulerEventDispatcher(this.scheduler) {
          @Override
          public void handle(SchedulerEvent event) {
            super.handle(event);
          }
        };
      }

      @Override
      protected Dispatcher createDispatcher() {
        return new DrainDispatcher();
      }
    };

    rm1.start();
    return rm1;
  }
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:TestNodeBlacklistingOnAMFailures.java


示例7: testRMShutdown

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test (timeout = 10000)
public void testRMShutdown() throws Exception {
  MemoryRMStateStore memStore = new MemoryRMStateStore() {
    @Override
    public synchronized void checkVersion()
        throws Exception {
      throw new Exception("Invalid version.");
    }
  };
  // start RM
  memStore.init(conf);
  MockRM rm1 = null;
  try {
    rm1 = new MockRM(conf, memStore);
    rm1.start();
    Assert.fail();
  } catch (Exception e) {
    Assert.assertTrue(e.getMessage().contains("Invalid version."));
  }
  Assert.assertTrue(rm1.getServiceState() == STATE.STOPPED);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:22,代码来源:TestRMRestart.java


示例8: setup

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Before
public void setup() {
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
  ExitUtil.disableSystemExit();
  conf = new YarnConfiguration();
  UserGroupInformation.setConfiguration(conf);
  conf.set(YarnConfiguration.RM_STORE, MemoryRMStateStore.class.getName());
  conf.set(YarnConfiguration.RM_SCHEDULER, FairScheduler.class.getName());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:TestRMDelegationTokens.java


示例9: testRemoveExpiredMasterKeyInRMStateStore

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test(timeout = 15000)
public void testRemoveExpiredMasterKeyInRMStateStore() throws Exception {
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  RMState rmState = memStore.getState();

  Set<DelegationKey> rmDTMasterKeyState =
      rmState.getRMDTSecretManagerState().getMasterKeyState();

  MockRM rm1 = new MyMockRM(conf, memStore);
  rm1.start();
  RMDelegationTokenSecretManager dtSecretManager =
      rm1.getRMContext().getRMDelegationTokenSecretManager();

  // assert all master keys are saved
  Assert.assertEquals(dtSecretManager.getAllMasterKeys(), rmDTMasterKeyState);
  Set<DelegationKey> expiringKeys = new HashSet<DelegationKey>();
  expiringKeys.addAll(dtSecretManager.getAllMasterKeys());

  // wait for expiringKeys to expire
  while (true) {
    boolean allExpired = true;
    for (DelegationKey key : expiringKeys) {
      if (rmDTMasterKeyState.contains(key)) {
        allExpired = false;
      }
    }
    if (allExpired)
      break;
    Thread.sleep(500);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:TestRMDelegationTokens.java


示例10: setup

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Before
public void setup() throws IOException {
  conf = getConf();
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
  UserGroupInformation.setConfiguration(conf);
  conf.setBoolean(YarnConfiguration.RECOVERY_ENABLED, true);
  conf.setBoolean(YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, false);
  conf.set(YarnConfiguration.RM_STORE, MemoryRMStateStore.class.getName());
  rmAddr = new InetSocketAddress("localhost", 8032);
  Assert.assertTrue(YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS > 1);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:TestRMRestart.java


示例11: testAppSubmissionWithOldDelegationTokenAfterRMRestart

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test (timeout = 60000)
public void testAppSubmissionWithOldDelegationTokenAfterRMRestart()
    throws Exception {
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 2);
  conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
      "kerberos");
  conf.set(YarnConfiguration.RM_ADDRESS, "localhost:8032");
  UserGroupInformation.setConfiguration(conf);
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);

  MockRM rm1 = new TestSecurityMockRM(conf, memStore);
  rm1.start();

  GetDelegationTokenRequest request1 =
      GetDelegationTokenRequest.newInstance("renewer1");
  UserGroupInformation.getCurrentUser().setAuthenticationMethod(
      AuthMethod.KERBEROS);
  GetDelegationTokenResponse response1 =
      rm1.getClientRMService().getDelegationToken(request1);
  Token<RMDelegationTokenIdentifier> token1 =
      ConverterUtils.convertFromYarn(response1.getRMDelegationToken(), rmAddr);

  // start new RM
  MockRM rm2 = new TestSecurityMockRM(conf, memStore);
  rm2.start();

  // submit an app with the old delegation token got from previous RM.
  Credentials ts = new Credentials();
  ts.addToken(token1.getService(), token1);
  RMApp app = rm2.submitApp(200, "name", "user",
      new HashMap<ApplicationAccessType, String>(), false, "default", 1, ts);
  rm2.waitForState(app.getApplicationId(), RMAppState.ACCEPTED);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:TestRMRestart.java


示例12: testClientRetryOnKillingApplication

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test (timeout = 60000)
public void testClientRetryOnKillingApplication() throws Exception {
  MemoryRMStateStore memStore = new TestMemoryRMStateStore();
  memStore.init(conf);

  // start RM
  MockRM rm1 = createMockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();

  RMApp app1 =
      rm1.submitApp(200, "name", "user", null, false, "default", 1, null,
        "myType");
  MockAM am1 = launchAM(app1, rm1, nm1);

  KillApplicationResponse response;
  int count = 0;
  while (true) {
    response = rm1.killApp(app1.getApplicationId());
    if (response.getIsKillCompleted()) {
      break;
    }
    Thread.sleep(100);
    count++;
  }
  // we expect at least 2 calls for killApp as the first killApp always return
  // false.
  Assert.assertTrue(count >= 1);

  rm1.waitForState(am1.getApplicationAttemptId(), RMAppAttemptState.KILLED);
  rm1.waitForState(app1.getApplicationId(), RMAppState.KILLED);
  Assert.assertEquals(1, ((TestMemoryRMStateStore) memStore).updateAttempt);
  Assert.assertEquals(2, ((TestMemoryRMStateStore) memStore).updateApp);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:TestRMRestart.java


示例13: setup

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Before
public void setup() throws UnknownHostException {
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
  conf = new YarnConfiguration();
  UserGroupInformation.setConfiguration(conf);
  conf.set(YarnConfiguration.RECOVERY_ENABLED, "true");
  conf.set(YarnConfiguration.RM_STORE, MemoryRMStateStore.class.getName());
  Assert.assertTrue(YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS > 1);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:TestApplicationCleanup.java


示例14: testAppCleanupWhenRMRestartedAfterAppFinished

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@SuppressWarnings("resource")
@Test (timeout = 60000)
public void testAppCleanupWhenRMRestartedAfterAppFinished() throws Exception {
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 1);
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);

  // start RM
  MockRM rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();

  // create app and launch the AM
  RMApp app0 = rm1.submitApp(200);
  MockAM am0 = launchAM(app0, rm1, nm1);
  nm1.nodeHeartbeat(am0.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  rm1.waitForState(app0.getApplicationId(), RMAppState.FAILED);

  // start new RM
  MockRM rm2 = new MockRM(conf, memStore);
  rm2.start();
  
  // nm1 register to rm2, and do a heartbeat
  nm1.setResourceTrackerService(rm2.getResourceTrackerService());
  nm1.registerNode(Arrays.asList(app0.getApplicationId()));
  rm2.waitForState(app0.getApplicationId(), RMAppState.FAILED);
  
  // wait for application cleanup message received
  waitForAppCleanupMessageRecved(nm1, app0.getApplicationId());
  
  rm1.stop();
  rm2.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:TestApplicationCleanup.java


示例15: testAppCleanupWhenNMReconnects

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test (timeout = 60000)
public void testAppCleanupWhenNMReconnects() throws Exception {
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 1);
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);

  // start RM
  MockRM rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();

  // create app and launch the AM
  RMApp app0 = rm1.submitApp(200);
  MockAM am0 = launchAM(app0, rm1, nm1);
  nm1.nodeHeartbeat(am0.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  rm1.waitForState(app0.getApplicationId(), RMAppState.FAILED);

  // wait for application cleanup message received
  waitForAppCleanupMessageRecved(nm1, app0.getApplicationId());

  // reconnect NM with application still active
  nm1.registerNode(Arrays.asList(app0.getApplicationId()));
  waitForAppCleanupMessageRecved(nm1, app0.getApplicationId());

  rm1.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestApplicationCleanup.java


示例16: setup

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Before
public void setup() throws UnknownHostException {
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
  conf = getConf();
  UserGroupInformation.setConfiguration(conf);
  conf.set(YarnConfiguration.RECOVERY_ENABLED, "true");
  conf.set(YarnConfiguration.RM_STORE, MemoryRMStateStore.class.getName());
  conf.setBoolean(YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, true);
  conf.setLong(YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_SCHEDULING_WAIT_MS, 0);
  DefaultMetricsSystem.setMiniClusterMode(true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:TestWorkPreservingRMRestart.java


示例17: testContainersNotRecoveredForCompletedApps

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test(timeout = 20000)
public void testContainersNotRecoveredForCompletedApps() throws Exception {
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 8192, rm1.getResourceTrackerService());
  nm1.registerNode();
  RMApp app1 = rm1.submitApp(200);
  MockAM am1 = MockRM.launchAndRegisterAM(app1, rm1, nm1);
  MockRM.finishAMAndVerifyAppState(app1, rm1, nm1, am1);

  rm2 = new MockRM(conf, memStore);
  rm2.start();
  nm1.setResourceTrackerService(rm2.getResourceTrackerService());
  NMContainerStatus runningContainer =
      TestRMRestart.createNMContainerStatus(am1.getApplicationAttemptId(), 2,
        ContainerState.RUNNING);
  NMContainerStatus completedContainer =
      TestRMRestart.createNMContainerStatus(am1.getApplicationAttemptId(), 3,
        ContainerState.COMPLETE);
  nm1.registerNode(Arrays.asList(runningContainer, completedContainer), null);
  RMApp recoveredApp1 =
      rm2.getRMContext().getRMApps().get(app1.getApplicationId());
  assertEquals(RMAppState.FINISHED, recoveredApp1.getState());

  // Wait for RM to settle down on recovering containers;
  Thread.sleep(3000);

  AbstractYarnScheduler scheduler =
      (AbstractYarnScheduler) rm2.getResourceScheduler();

  // scheduler should not recover containers for finished apps.
  assertNull(scheduler.getRMContainer(runningContainer.getContainerId()));
  assertNull(scheduler.getRMContainer(completedContainer.getContainerId()));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:TestWorkPreservingRMRestart.java


示例18: testAppReregisterOnRMWorkPreservingRestart

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test (timeout = 600000)
public void testAppReregisterOnRMWorkPreservingRestart() throws Exception {
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 1);
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);

  // start RM
  rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();

  // create app and launch the AM
  RMApp app0 = rm1.submitApp(200);
  MockAM am0 = MockRM.launchAM(app0, rm1, nm1);
  // Issuing registerAppAttempt() before and after RM restart to confirm
  // registerApplicationMaster() is idempotent.
  am0.registerAppAttempt();

  // start new RM
  rm2 = new MockRM(conf, memStore);
  rm2.start();
  rm2.waitForState(app0.getApplicationId(), RMAppState.ACCEPTED);
  rm2.waitForState(am0.getApplicationAttemptId(), RMAppAttemptState.LAUNCHED);

  am0.setAMRMProtocol(rm2.getApplicationMasterService(), rm2.getRMContext());
  // retry registerApplicationMaster() after RM restart.
  am0.registerAppAttempt(true);

  rm2.waitForState(app0.getApplicationId(), RMAppState.RUNNING);
  rm2.waitForState(am0.getApplicationAttemptId(), RMAppAttemptState.RUNNING);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:34,代码来源:TestWorkPreservingRMRestart.java


示例19: testAMContainerStatusWithRMRestart

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test (timeout = 30000)
public void testAMContainerStatusWithRMRestart() throws Exception {  
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 8192, rm1.getResourceTrackerService());
  nm1.registerNode();
  RMApp app1_1 = rm1.submitApp(1024);
  MockAM am1_1 = MockRM.launchAndRegisterAM(app1_1, rm1, nm1);
  
  RMAppAttempt attempt0 = app1_1.getCurrentAppAttempt();
  AbstractYarnScheduler scheduler =
      ((AbstractYarnScheduler) rm1.getResourceScheduler());
  
  Assert.assertTrue(scheduler.getRMContainer(
      attempt0.getMasterContainer().getId()).isAMContainer());

  // Re-start RM
  rm2 = new MockRM(conf, memStore);
  rm2.start();
  nm1.setResourceTrackerService(rm2.getResourceTrackerService());

  List<NMContainerStatus> am1_1Containers =
      createNMContainerStatusForApp(am1_1);
  nm1.registerNode(am1_1Containers, null);

  // Wait for RM to settle down on recovering containers;
  waitForNumContainersToRecover(2, rm2, am1_1.getApplicationAttemptId());

  scheduler = ((AbstractYarnScheduler) rm2.getResourceScheduler());
  Assert.assertTrue(scheduler.getRMContainer(
      attempt0.getMasterContainer().getId()).isAMContainer());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:TestWorkPreservingRMRestart.java


示例20: testRecoverSchedulerAppAndAttemptSynchronously

import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore; //导入依赖的package包/类
@Test (timeout = 20000)
public void testRecoverSchedulerAppAndAttemptSynchronously() throws Exception {
  // start RM
  MemoryRMStateStore memStore = new MemoryRMStateStore();
  memStore.init(conf);
  rm1 = new MockRM(conf, memStore);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();

  // create app and launch the AM
  RMApp app0 = rm1.submitApp(200);
  MockAM am0 = MockRM.launchAndRegisterAM(app0, rm1, nm1);

  rm2 = new MockRM(conf, memStore);
  rm2.start();
  nm1.setResourceTrackerService(rm2.getResourceTrackerService());
  // scheduler app/attempt is immediately available after RM is re-started.
  Assert.assertNotNull(rm2.getResourceScheduler().getSchedulerAppInfo(
    am0.getApplicationAttemptId()));

  // getTransferredContainers should not throw NPE.
  ((AbstractYarnScheduler) rm2.getResourceScheduler())
    .getTransferredContainers(am0.getApplicationAttemptId());

  List<NMContainerStatus> containers = createNMContainerStatusForApp(am0);
  nm1.registerNode(containers, null);
  waitForNumContainersToRecover(2, rm2, am0.getApplicationAttemptId());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestWorkPreservingRMRestart.java



注:本文中的org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractSerializationsTester类代码示例发布时间:2022-05-22
下一篇:
Java GetServiceStatusResponseProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap