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


Java AppRemovedSchedulerEvent类代码示例

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


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

示例1: transition

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
public void transition(RMAppImpl app, RMAppEvent event) {
  for (NodeId nodeId : app.getRanNodes()) {
    app.handler.handle(
        new RMNodeCleanAppEvent(nodeId, app.applicationId));
  }
  app.finishTime = app.storedFinishTime;
  if (app.finishTime == 0 ) {
    app.finishTime = app.systemClock.getTime();
  }
  // Recovered apps that are completed were not added to scheduler, so no
  // need to remove them from scheduler.
  if (app.recoveredFinalState == null) {
    app.handler.handle(new AppRemovedSchedulerEvent(app.applicationId,
      finalState));
  }
  app.handler.handle(
      new RMAppManagerEvent(app.applicationId,
      RMAppManagerEventType.APP_COMPLETED));

  app.rmContext.getRMApplicationHistoryWriter()
      .applicationFinished(app, finalState);
  app.rmContext.getSystemMetricsPublisher()
      .appFinished(app, finalState, app.finishTime);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:RMAppImpl.java

示例2: verifyAppAddedAndRemovedFromScheduler

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
public static SchedulerApplication<SchedulerApplicationAttempt>
    verifyAppAddedAndRemovedFromScheduler(
        Map<ApplicationId, SchedulerApplication<SchedulerApplicationAttempt>> applications,
        EventHandler<SchedulerEvent> handler, String queueName)
        throws Exception {
  ApplicationId appId =
      ApplicationId.newInstance(System.currentTimeMillis(), 1);
  AppAddedSchedulerEvent appAddedEvent =
      new AppAddedSchedulerEvent(appId, queueName, "user");
  handler.handle(appAddedEvent);
  SchedulerApplication<SchedulerApplicationAttempt> app =
      applications.get(appId);
  // verify application is added.
  Assert.assertNotNull(app);
  Assert.assertEquals("user", app.getUser());

  AppRemovedSchedulerEvent appRemoveEvent =
      new AppRemovedSchedulerEvent(appId, RMAppState.FINISHED);
  handler.handle(appRemoveEvent);
  Assert.assertNull(applications.get(appId));
  return app;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestSchedulerUtils.java

示例3: transition

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
public void transition(RMAppImpl app, RMAppEvent event) {
  app.logAggregationStartTime = System.currentTimeMillis();
  for (NodeId nodeId : app.getRanNodes()) {
    app.handler.handle(
        new RMNodeCleanAppEvent(nodeId, app.applicationId));
  }
  app.finishTime = app.storedFinishTime;
  if (app.finishTime == 0 ) {
    app.finishTime = app.systemClock.getTime();
  }
  // Recovered apps that are completed were not added to scheduler, so no
  // need to remove them from scheduler.
  if (app.recoveredFinalState == null) {
    app.handler.handle(new AppRemovedSchedulerEvent(app.applicationId,
      finalState));
  }
  app.handler.handle(
      new RMAppManagerEvent(app.applicationId,
      RMAppManagerEventType.APP_COMPLETED));

  app.rmContext.getRMApplicationHistoryWriter()
      .applicationFinished(app, finalState);
  app.rmContext.getSystemMetricsPublisher()
      .appFinished(app, finalState, app.finishTime);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:RMAppImpl.java

示例4: testAppAdditionAndRemoval

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
@Test
public void testAppAdditionAndRemoval() throws Exception {
  AppAddedSchedulerEvent appAddedEvent1 = new AppAddedSchedulerEvent(
      createAppAttemptId(1, 1), "default", "user1");
  scheduler.handle(appAddedEvent1);

  // Scheduler should have two queues (the default and the one created for user1)
  assertEquals(2, scheduler.getQueueManager().getLeafQueues().size());

  // That queue should have one app
  assertEquals(1, scheduler.getQueueManager().getLeafQueue("user1")
      .getAppSchedulables().size());

  AppRemovedSchedulerEvent appRemovedEvent1 = new AppRemovedSchedulerEvent(
      createAppAttemptId(1, 1), RMAppAttemptState.FINISHED);

  // Now remove app
  scheduler.handle(appRemovedEvent1);

  // Queue should have no apps
  assertEquals(0, scheduler.getQueueManager().getLeafQueue("user1")
      .getAppSchedulables().size());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:24,代码来源:TestFairScheduler.java

示例5: testAppAdditionAndRemoval

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
@Test
public void testAppAdditionAndRemoval() throws Exception {
  AppAddedSchedulerEvent appAddedEvent1 = new AppAddedSchedulerEvent(
      createAppAttemptId(1, 1), "default", "user1");
  scheduler.handle(appAddedEvent1);

  // Scheduler should have two queues (the default and the one created for user1)
  assertEquals(2, scheduler.getQueueManager().getLeafQueues().size());

  // That queue should have one app
  assertEquals(1, scheduler.getQueueManager().getLeafQueue("user1", true)
      .getAppSchedulables().size());

  AppRemovedSchedulerEvent appRemovedEvent1 = new AppRemovedSchedulerEvent(
      createAppAttemptId(1, 1), RMAppAttemptState.FINISHED);

  // Now remove app
  scheduler.handle(appRemovedEvent1);

  // Queue should have no apps
  assertEquals(0, scheduler.getQueueManager().getLeafQueue("user1", true)
      .getAppSchedulables().size());
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:24,代码来源:TestFairScheduler.java

示例6: transition

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
public void transition(RMAppImpl app, RMAppEvent event) {
  Set<NodeId> nodes = getNodesOnWhichAttemptRan(app);
  for (NodeId nodeId : nodes) {
    app.handler.handle(
        new RMNodeCleanAppEvent(nodeId, app.applicationId));
  }
  app.finishTime = app.storedFinishTime;
  if (app.finishTime == 0 ) {
    app.finishTime = System.currentTimeMillis();
  }
  app.handler.handle(new AppRemovedSchedulerEvent(app.applicationId,
    finalState));
  app.handler.handle(
      new RMAppManagerEvent(app.applicationId,
      RMAppManagerEventType.APP_COMPLETED));

  app.rmContext.getRMApplicationHistoryWriter()
      .applicationFinished(app, finalState);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:20,代码来源:RMAppImpl.java

示例7: verifyAppAddedAndRemovedFromScheduler

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
public static <T> SchedulerApplication verifyAppAddedAndRemovedFromScheduler(
    final Map<ApplicationId, SchedulerApplication> applications,
    EventHandler<SchedulerEvent> handler, String queueName) throws Exception {
  ApplicationId appId =
      ApplicationId.newInstance(System.currentTimeMillis(), 1);
  AppAddedSchedulerEvent appAddedEvent =
      new AppAddedSchedulerEvent(appId, queueName, "user");
  handler.handle(appAddedEvent);
  SchedulerApplication app = applications.get(appId);
  // verify application is added.
  Assert.assertNotNull(app);
  Assert.assertEquals("user", app.getUser());

  AppRemovedSchedulerEvent appRemoveEvent =
      new AppRemovedSchedulerEvent(appId, RMAppState.FINISHED);
  handler.handle(appRemoveEvent);
  Assert.assertNull(applications.get(appId));
  return app;
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:20,代码来源:TestSchedulerUtils.java

示例8: verifyAppRemovedSchedulerEvent

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
private void verifyAppRemovedSchedulerEvent(RMAppState finalState) {
  Assert.assertEquals(SchedulerEventType.APP_REMOVED,
    schedulerDispatcher.lastSchedulerEvent.getType());
  if(schedulerDispatcher.lastSchedulerEvent instanceof 
      AppRemovedSchedulerEvent) {
    AppRemovedSchedulerEvent appRemovedEvent =
        (AppRemovedSchedulerEvent) schedulerDispatcher.lastSchedulerEvent;
    Assert.assertEquals(finalState, appRemovedEvent.getFinalState());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:TestRMAppTransitions.java

示例9: handle

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
@Override
public void handle(SchedulerEvent event) {
  switch(event.getType()) {
  case NODE_ADDED:
  {
    NodeAddedSchedulerEvent nodeAddedEvent = (NodeAddedSchedulerEvent)event;
    addNode(nodeAddedEvent.getAddedRMNode());
  }
  break;
  case NODE_REMOVED:
  {
    NodeRemovedSchedulerEvent nodeRemovedEvent = (NodeRemovedSchedulerEvent)event;
    removeNode(nodeRemovedEvent.getRemovedRMNode());
  }
  break;
  case NODE_UPDATE:
  {
    NodeUpdateSchedulerEvent nodeUpdatedEvent = 
    (NodeUpdateSchedulerEvent)event;
    nodeUpdate(nodeUpdatedEvent.getRMNode());
  }
  break;
  case APP_ADDED:
  {
    AppAddedSchedulerEvent appAddedEvent = (AppAddedSchedulerEvent) event;
    addApplication(appAddedEvent.getApplicationAttemptId(), appAddedEvent
        .getUser());
  }
  break;
  case APP_REMOVED:
  {
    AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent)event;
    try {
      doneApplication(appRemovedEvent.getApplicationAttemptID(),
          appRemovedEvent.getFinalAttemptState());
    } catch(IOException ie) {
      LOG.error("Unable to remove application "
          + appRemovedEvent.getApplicationAttemptID(), ie);
    }
  }
  break;
  case CONTAINER_EXPIRED:
  {
    ContainerExpiredSchedulerEvent containerExpiredEvent = 
        (ContainerExpiredSchedulerEvent) event;
    ContainerId containerid = containerExpiredEvent.getContainerId();
    containerCompleted(getRMContainer(containerid), 
        SchedulerUtils.createAbnormalContainerStatus(
            containerid, 
            SchedulerUtils.EXPIRED_CONTAINER),
        RMContainerEventType.EXPIRE);
  }
  break;
  default:
    LOG.error("Invalid eventtype " + event.getType() + ". Ignoring!");
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:58,代码来源:FifoScheduler.java

示例10: handle

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
@Override
public void handle(SchedulerEvent event) {
  switch (event.getType()) {
  case NODE_ADDED:
    if (!(event instanceof NodeAddedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    NodeAddedSchedulerEvent nodeAddedEvent = (NodeAddedSchedulerEvent)event;
    addNode(nodeAddedEvent.getAddedRMNode());
    break;
  case NODE_REMOVED:
    if (!(event instanceof NodeRemovedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    NodeRemovedSchedulerEvent nodeRemovedEvent = (NodeRemovedSchedulerEvent)event;
    removeNode(nodeRemovedEvent.getRemovedRMNode());
    break;
  case NODE_UPDATE:
    if (!(event instanceof NodeUpdateSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    NodeUpdateSchedulerEvent nodeUpdatedEvent = (NodeUpdateSchedulerEvent)event;
    nodeUpdate(nodeUpdatedEvent.getRMNode());
    break;
  case APP_ADDED:
    if (!(event instanceof AppAddedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    AppAddedSchedulerEvent appAddedEvent = (AppAddedSchedulerEvent)event;
    String queue = appAddedEvent.getQueue();
    addApplication(appAddedEvent.getApplicationAttemptId(), queue,
        appAddedEvent.getUser());
    break;
  case APP_REMOVED:
    if (!(event instanceof AppRemovedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent)event;
    removeApplication(appRemovedEvent.getApplicationAttemptID(),
        appRemovedEvent.getFinalAttemptState());
    break;
  case CONTAINER_EXPIRED:
    if (!(event instanceof ContainerExpiredSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    ContainerExpiredSchedulerEvent containerExpiredEvent =
        (ContainerExpiredSchedulerEvent)event;
    ContainerId containerId = containerExpiredEvent.getContainerId();
    completedContainer(getRMContainer(containerId),
        SchedulerUtils.createAbnormalContainerStatus(
            containerId,
            SchedulerUtils.EXPIRED_CONTAINER),
        RMContainerEventType.EXPIRE);
    break;
  default:
    LOG.error("Unknown event arrived at FairScheduler: " + event.toString());
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:59,代码来源:FairScheduler.java

示例11: handle

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
@Override
public void handle(SchedulerEvent event) {
  switch(event.getType()) {
  case NODE_ADDED:
  {
    NodeAddedSchedulerEvent nodeAddedEvent = (NodeAddedSchedulerEvent)event;
    addNode(nodeAddedEvent.getAddedRMNode());
  }
  break;
  case NODE_REMOVED:
  {
    NodeRemovedSchedulerEvent nodeRemovedEvent = (NodeRemovedSchedulerEvent)event;
    removeNode(nodeRemovedEvent.getRemovedRMNode());
  }
  break;
  case NODE_UPDATE:
  {
    NodeUpdateSchedulerEvent nodeUpdatedEvent = (NodeUpdateSchedulerEvent)event;
    nodeUpdate(nodeUpdatedEvent.getRMNode());
  }
  break;
  case APP_ADDED:
  {
    AppAddedSchedulerEvent appAddedEvent = (AppAddedSchedulerEvent)event;
    addApplication(appAddedEvent.getApplicationAttemptId(), appAddedEvent
        .getQueue(), appAddedEvent.getUser());
  }
  break;
  case APP_REMOVED:
  {
    AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent)event;
    doneApplication(appRemovedEvent.getApplicationAttemptID(),
        appRemovedEvent.getFinalAttemptState());
  }
  break;
  case CONTAINER_EXPIRED:
  {
    ContainerExpiredSchedulerEvent containerExpiredEvent = 
        (ContainerExpiredSchedulerEvent) event;
    ContainerId containerId = containerExpiredEvent.getContainerId();
    completedContainer(getRMContainer(containerId), 
        SchedulerUtils.createAbnormalContainerStatus(
            containerId, 
            SchedulerUtils.EXPIRED_CONTAINER), 
        RMContainerEventType.EXPIRE);
  }
  break;
  default:
    LOG.error("Invalid eventtype " + event.getType() + ". Ignoring!");
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:52,代码来源:CapacityScheduler.java

示例12: handle

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
@Override
public void handle(SchedulerEvent event) {
  switch(event.getType()) {
  case NODE_ADDED:
  {
    NodeAddedSchedulerEvent nodeAddedEvent = (NodeAddedSchedulerEvent)event;
    addNode(nodeAddedEvent.getAddedRMNode());
  }
  break;
  case NODE_REMOVED:
  {
    NodeRemovedSchedulerEvent nodeRemovedEvent = (NodeRemovedSchedulerEvent)event;
    removeNode(nodeRemovedEvent.getRemovedRMNode());
  }
  break;
  case NODE_UPDATE:
  {
    NodeUpdateSchedulerEvent nodeUpdatedEvent = 
    (NodeUpdateSchedulerEvent)event;
    nodeUpdate(nodeUpdatedEvent.getRMNode());
  }
  break;
  case APP_ADDED:
  {
    AppAddedSchedulerEvent appAddedEvent = (AppAddedSchedulerEvent) event;
    addApplication(appAddedEvent.getApplicationId(),
      appAddedEvent.getQueue(), appAddedEvent.getUser());
  }
  break;
  case APP_REMOVED:
  {
    AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent)event;
    doneApplication(appRemovedEvent.getApplicationID(),
      appRemovedEvent.getFinalState());
  }
  break;
  case APP_ATTEMPT_ADDED:
  {
    AppAttemptAddedSchedulerEvent appAttemptAddedEvent =
        (AppAttemptAddedSchedulerEvent) event;
    addApplicationAttempt(appAttemptAddedEvent.getApplicationAttemptId(),
      appAttemptAddedEvent.getTransferStateFromPreviousAttempt());
  }
  break;
  case APP_ATTEMPT_REMOVED:
  {
    AppAttemptRemovedSchedulerEvent appAttemptRemovedEvent =
        (AppAttemptRemovedSchedulerEvent) event;
    try {
      doneApplicationAttempt(
        appAttemptRemovedEvent.getApplicationAttemptID(),
        appAttemptRemovedEvent.getFinalAttemptState(),
        appAttemptRemovedEvent.getKeepContainersAcrossAppAttempts());
    } catch(IOException ie) {
      LOG.error("Unable to remove application "
          + appAttemptRemovedEvent.getApplicationAttemptID(), ie);
    }
  }
  break;
  case CONTAINER_EXPIRED:
  {
    ContainerExpiredSchedulerEvent containerExpiredEvent = 
        (ContainerExpiredSchedulerEvent) event;
    ContainerId containerid = containerExpiredEvent.getContainerId();
    containerCompleted(getRMContainer(containerid), 
        SchedulerUtils.createAbnormalContainerStatus(
            containerid, 
            SchedulerUtils.EXPIRED_CONTAINER),
        RMContainerEventType.EXPIRE);
  }
  break;
  default:
    LOG.error("Invalid eventtype " + event.getType() + ". Ignoring!");
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:76,代码来源:FifoScheduler.java

示例13: handle

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
@Override
public void handle(SchedulerEvent event) {
  switch (event.getType()) {
  case NODE_ADDED:
    if (!(event instanceof NodeAddedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    NodeAddedSchedulerEvent nodeAddedEvent = (NodeAddedSchedulerEvent)event;
    addNode(nodeAddedEvent.getAddedRMNode());
    break;
  case NODE_REMOVED:
    if (!(event instanceof NodeRemovedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    NodeRemovedSchedulerEvent nodeRemovedEvent = (NodeRemovedSchedulerEvent)event;
    removeNode(nodeRemovedEvent.getRemovedRMNode());
    break;
  case NODE_UPDATE:
    if (!(event instanceof NodeUpdateSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    NodeUpdateSchedulerEvent nodeUpdatedEvent = (NodeUpdateSchedulerEvent)event;
    nodeUpdate(nodeUpdatedEvent.getRMNode());
    break;
  case APP_ADDED:
    if (!(event instanceof AppAddedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    AppAddedSchedulerEvent appAddedEvent = (AppAddedSchedulerEvent) event;
    addApplication(appAddedEvent.getApplicationId(),
      appAddedEvent.getQueue(), appAddedEvent.getUser());
    break;
  case APP_REMOVED:
    if (!(event instanceof AppRemovedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent)event;
    removeApplication(appRemovedEvent.getApplicationID(),
      appRemovedEvent.getFinalState());
    break;
  case APP_ATTEMPT_ADDED:
    if (!(event instanceof AppAttemptAddedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    AppAttemptAddedSchedulerEvent appAttemptAddedEvent =
        (AppAttemptAddedSchedulerEvent) event;
    addApplicationAttempt(appAttemptAddedEvent.getApplicationAttemptId(),
      appAttemptAddedEvent.getTransferStateFromPreviousAttempt());
    break;
  case APP_ATTEMPT_REMOVED:
    if (!(event instanceof AppAttemptRemovedSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    AppAttemptRemovedSchedulerEvent appAttemptRemovedEvent =
        (AppAttemptRemovedSchedulerEvent) event;
    removeApplicationAttempt(
        appAttemptRemovedEvent.getApplicationAttemptID(),
        appAttemptRemovedEvent.getFinalAttemptState(),
        appAttemptRemovedEvent.getKeepContainersAcrossAppAttempts());
    break;
  case CONTAINER_EXPIRED:
    if (!(event instanceof ContainerExpiredSchedulerEvent)) {
      throw new RuntimeException("Unexpected event type: " + event);
    }
    ContainerExpiredSchedulerEvent containerExpiredEvent =
        (ContainerExpiredSchedulerEvent)event;
    ContainerId containerId = containerExpiredEvent.getContainerId();
    completedContainer(getRMContainer(containerId),
        SchedulerUtils.createAbnormalContainerStatus(
            containerId,
            SchedulerUtils.EXPIRED_CONTAINER),
        RMContainerEventType.EXPIRE);
    break;
  default:
    LOG.error("Unknown event arrived at FairScheduler: " + event.toString());
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:78,代码来源:FairScheduler.java

示例14: handle

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent; //导入依赖的package包/类
@Override
public void handle(SchedulerEvent event) {
  switch(event.getType()) {
  case NODE_ADDED:
  {
    NodeAddedSchedulerEvent nodeAddedEvent = (NodeAddedSchedulerEvent)event;
    addNode(nodeAddedEvent.getAddedRMNode());
  }
  break;
  case NODE_REMOVED:
  {
    NodeRemovedSchedulerEvent nodeRemovedEvent = (NodeRemovedSchedulerEvent)event;
    removeNode(nodeRemovedEvent.getRemovedRMNode());
  }
  break;
  case NODE_UPDATE:
  {
    NodeUpdateSchedulerEvent nodeUpdatedEvent = (NodeUpdateSchedulerEvent)event;
    RMNode node = nodeUpdatedEvent.getRMNode();
    nodeUpdate(node);
    if (!scheduleAsynchronously) {
      allocateContainersToNode(getNode(node.getNodeID()));
    }
  }
  break;
  case APP_ADDED:
  {
    AppAddedSchedulerEvent appAddedEvent = (AppAddedSchedulerEvent) event;
    addApplication(appAddedEvent.getApplicationId(),
      appAddedEvent.getQueue(), appAddedEvent.getUser());
  }
  break;
  case APP_REMOVED:
  {
    AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent)event;
    doneApplication(appRemovedEvent.getApplicationID(),
      appRemovedEvent.getFinalState());
  }
  break;
  case APP_ATTEMPT_ADDED:
  {
    AppAttemptAddedSchedulerEvent appAttemptAddedEvent =
        (AppAttemptAddedSchedulerEvent) event;
    addApplicationAttempt(appAttemptAddedEvent.getApplicationAttemptId(),
      appAttemptAddedEvent.getTransferStateFromPreviousAttempt());
  }
  break;
  case APP_ATTEMPT_REMOVED:
  {
    AppAttemptRemovedSchedulerEvent appAttemptRemovedEvent =
        (AppAttemptRemovedSchedulerEvent) event;
    doneApplicationAttempt(appAttemptRemovedEvent.getApplicationAttemptID(),
      appAttemptRemovedEvent.getFinalAttemptState(),
      appAttemptRemovedEvent.getKeepContainersAcrossAppAttempts());
  }
  break;
  case CONTAINER_EXPIRED:
  {
    ContainerExpiredSchedulerEvent containerExpiredEvent = 
        (ContainerExpiredSchedulerEvent) event;
    ContainerId containerId = containerExpiredEvent.getContainerId();
    completedContainer(getRMContainer(containerId), 
        SchedulerUtils.createAbnormalContainerStatus(
            containerId, 
            SchedulerUtils.EXPIRED_CONTAINER), 
        RMContainerEventType.EXPIRE);
  }
  break;
  default:
    LOG.error("Invalid eventtype " + event.getType() + ". Ignoring!");
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:73,代码来源:CapacityScheduler.java


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