当前位置: 首页>>代码示例>>Java>>正文


Java RMAppAttemptState.KILLED属性代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState.KILLED属性的典型用法代码示例。如果您正苦于以下问题:Java RMAppAttemptState.KILLED属性的具体用法?Java RMAppAttemptState.KILLED怎么用?Java RMAppAttemptState.KILLED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState的用法示例。


在下文中一共展示了RMAppAttemptState.KILLED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMaxRunningAppsHierarchicalQueues

@Test
public void testMaxRunningAppsHierarchicalQueues() throws Exception {
  conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
  MockClock clock = new MockClock();
  scheduler.setClock(clock);

  PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
  out.println("<?xml version=\"1.0\"?>");
  out.println("<allocations>");
  out.println("<queue name=\"queue1\">");
  out.println("  <maxRunningApps>3</maxRunningApps>");
  out.println("  <queue name=\"sub1\"></queue>");
  out.println("  <queue name=\"sub2\"></queue>");
  out.println("  <queue name=\"sub3\">");
  out.println("    <maxRunningApps>1</maxRunningApps>");
  out.println("  </queue>");
  out.println("</queue>");
  out.println("</allocations>");
  out.close();

  scheduler.init(conf);
  scheduler.start();
  scheduler.reinitialize(conf, resourceManager.getRMContext());

  // exceeds no limits
  ApplicationAttemptId attId1 = createSchedulingRequest(1024, "queue1.sub1", "user1");
  verifyAppRunnable(attId1, true);
  verifyQueueNumRunnable("queue1.sub1", 1, 0);
  clock.tick(10);
  // exceeds no limits
  ApplicationAttemptId attId2 = createSchedulingRequest(1024, "queue1.sub3", "user1");
  verifyAppRunnable(attId2, true);
  verifyQueueNumRunnable("queue1.sub3", 1, 0);
  clock.tick(10);
  // exceeds no limits
  ApplicationAttemptId attId3 = createSchedulingRequest(1024, "queue1.sub2", "user1");
  verifyAppRunnable(attId3, true);
  verifyQueueNumRunnable("queue1.sub2", 1, 0);
  clock.tick(10);
  // exceeds queue1 limit
  ApplicationAttemptId attId4 = createSchedulingRequest(1024, "queue1.sub2", "user1");
  verifyAppRunnable(attId4, false);
  verifyQueueNumRunnable("queue1.sub2", 1, 1);
  clock.tick(10);
  // exceeds sub3 limit
  ApplicationAttemptId attId5 = createSchedulingRequest(1024, "queue1.sub3", "user1");
  verifyAppRunnable(attId5, false);
  verifyQueueNumRunnable("queue1.sub3", 1, 1);
  clock.tick(10);
  
  // Even though the app was removed from sub3, the app from sub2 gets to go
  // because it came in first
  AppAttemptRemovedSchedulerEvent appRemovedEvent1 =
      new AppAttemptRemovedSchedulerEvent(attId2, RMAppAttemptState.FINISHED, false);
  scheduler.handle(appRemovedEvent1);
  verifyAppRunnable(attId4, true);
  verifyQueueNumRunnable("queue1.sub2", 2, 0);
  verifyAppRunnable(attId5, false);
  verifyQueueNumRunnable("queue1.sub3", 0, 1);

  // Now test removal of a non-runnable app
  AppAttemptRemovedSchedulerEvent appRemovedEvent2 =
      new AppAttemptRemovedSchedulerEvent(attId5, RMAppAttemptState.KILLED, true);
  scheduler.handle(appRemovedEvent2);
  assertEquals(0, scheduler.maxRunningEnforcer.usersNonRunnableApps
      .get("user1").size());
  // verify app gone in queue accounting
  verifyQueueNumRunnable("queue1.sub3", 0, 0);
  // verify it doesn't become runnable when there would be space for it
  AppAttemptRemovedSchedulerEvent appRemovedEvent3 =
      new AppAttemptRemovedSchedulerEvent(attId4, RMAppAttemptState.FINISHED, true);
  scheduler.handle(appRemovedEvent3);
  verifyQueueNumRunnable("queue1.sub2", 1, 0);
  verifyQueueNumRunnable("queue1.sub3", 0, 0);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:75,代码来源:TestFairScheduler.java

示例2: transition

@Override
public RMAppState transition(RMAppImpl app, RMAppEvent event) {

  RMAppRecoverEvent recoverEvent = (RMAppRecoverEvent) event;
  app.recover(recoverEvent.getRMState());
  // The app has completed.
  if (app.recoveredFinalState != null) {
    app.recoverAppAttempts();
    new FinalTransition(app.recoveredFinalState).transition(app, event);
    return app.recoveredFinalState;
  }

  if (UserGroupInformation.isSecurityEnabled()) {
    // synchronously renew delegation token on recovery.
    try {
      app.rmContext.getDelegationTokenRenewer().addApplicationSync(
        app.getApplicationId(), app.parseCredentials(),
        app.submissionContext.getCancelTokensWhenComplete(), app.getUser());
    } catch (Exception e) {
      String msg = "Failed to renew token for " + app.applicationId
              + " on recovery : " + e.getMessage();
      app.diagnostics.append(msg);
      LOG.error(msg, e);
    }
  }

  // No existent attempts means the attempt associated with this app was not
  // started or started but not yet saved.
  if (app.attempts.isEmpty()) {
    app.scheduler.handle(new AppAddedSchedulerEvent(app.applicationId,
      app.submissionContext.getQueue(), app.user,
      app.submissionContext.getReservationID()));
    return RMAppState.SUBMITTED;
  }

  // Add application to scheduler synchronously to guarantee scheduler
  // knows applications before AM or NM re-registers.
  app.scheduler.handle(new AppAddedSchedulerEvent(app.applicationId,
    app.submissionContext.getQueue(), app.user, true,
      app.submissionContext.getReservationID()));

  // recover attempts
  app.recoverAppAttempts();

  // Last attempt is in final state, return ACCEPTED waiting for last
  // RMAppAttempt to send finished or failed event back.
  if (app.currentAttempt != null
      && (app.currentAttempt.getState() == RMAppAttemptState.KILLED
          || app.currentAttempt.getState() == RMAppAttemptState.FINISHED
          || (app.currentAttempt.getState() == RMAppAttemptState.FAILED
              && app.getNumFailedAppAttempts() == app.maxAppAttempts))) {
    return RMAppState.ACCEPTED;
  }

  // YARN-1507 is saving the application state after the application is
  // accepted. So after YARN-1507, an app is saved meaning it is accepted.
  // Thus we return ACCECPTED state on recovery.
  return RMAppState.ACCEPTED;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:59,代码来源:RMAppImpl.java

示例3: testMaxRunningAppsHierarchicalQueues

@Test
public void testMaxRunningAppsHierarchicalQueues() throws Exception {
  conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
  ControlledClock clock = new ControlledClock();
  scheduler.setClock(clock);

  PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
  out.println("<?xml version=\"1.0\"?>");
  out.println("<allocations>");
  out.println("<queue name=\"queue1\">");
  out.println("  <maxRunningApps>3</maxRunningApps>");
  out.println("  <queue name=\"sub1\"></queue>");
  out.println("  <queue name=\"sub2\"></queue>");
  out.println("  <queue name=\"sub3\">");
  out.println("    <maxRunningApps>1</maxRunningApps>");
  out.println("  </queue>");
  out.println("</queue>");
  out.println("</allocations>");
  out.close();

  scheduler.init(conf);
  scheduler.start();
  scheduler.reinitialize(conf, resourceManager.getRMContext());

  // exceeds no limits
  ApplicationAttemptId attId1 = createSchedulingRequest(1024, "queue1.sub1", "user1");
  verifyAppRunnable(attId1, true);
  verifyQueueNumRunnable("queue1.sub1", 1, 0);
  clock.tickSec(10);
  // exceeds no limits
  ApplicationAttemptId attId2 = createSchedulingRequest(1024, "queue1.sub3", "user1");
  verifyAppRunnable(attId2, true);
  verifyQueueNumRunnable("queue1.sub3", 1, 0);
  clock.tickSec(10);
  // exceeds no limits
  ApplicationAttemptId attId3 = createSchedulingRequest(1024, "queue1.sub2", "user1");
  verifyAppRunnable(attId3, true);
  verifyQueueNumRunnable("queue1.sub2", 1, 0);
  clock.tickSec(10);
  // exceeds queue1 limit
  ApplicationAttemptId attId4 = createSchedulingRequest(1024, "queue1.sub2", "user1");
  verifyAppRunnable(attId4, false);
  verifyQueueNumRunnable("queue1.sub2", 1, 1);
  clock.tickSec(10);
  // exceeds sub3 limit
  ApplicationAttemptId attId5 = createSchedulingRequest(1024, "queue1.sub3", "user1");
  verifyAppRunnable(attId5, false);
  verifyQueueNumRunnable("queue1.sub3", 1, 1);
  clock.tickSec(10);

  // Even though the app was removed from sub3, the app from sub2 gets to go
  // because it came in first
  AppAttemptRemovedSchedulerEvent appRemovedEvent1 =
      new AppAttemptRemovedSchedulerEvent(attId2, RMAppAttemptState.FINISHED, false);
  scheduler.handle(appRemovedEvent1);
  verifyAppRunnable(attId4, true);
  verifyQueueNumRunnable("queue1.sub2", 2, 0);
  verifyAppRunnable(attId5, false);
  verifyQueueNumRunnable("queue1.sub3", 0, 1);

  // Now test removal of a non-runnable app
  AppAttemptRemovedSchedulerEvent appRemovedEvent2 =
      new AppAttemptRemovedSchedulerEvent(attId5, RMAppAttemptState.KILLED, true);
  scheduler.handle(appRemovedEvent2);
  assertEquals(0, scheduler.maxRunningEnforcer.usersNonRunnableApps
      .get("user1").size());
  // verify app gone in queue accounting
  verifyQueueNumRunnable("queue1.sub3", 0, 0);
  // verify it doesn't become runnable when there would be space for it
  AppAttemptRemovedSchedulerEvent appRemovedEvent3 =
      new AppAttemptRemovedSchedulerEvent(attId4, RMAppAttemptState.FINISHED, true);
  scheduler.handle(appRemovedEvent3);
  verifyQueueNumRunnable("queue1.sub2", 1, 0);
  verifyQueueNumRunnable("queue1.sub3", 0, 0);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:75,代码来源:TestFairScheduler.java


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