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


Java CMgrCompletedAppsEvent.getReason方法代码示例

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


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

示例1: handle

import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void handle(ContainerManagerEvent event) {
  switch (event.getType()) {
  case FINISH_APPS:
    CMgrCompletedAppsEvent appsFinishedEvent =
        (CMgrCompletedAppsEvent) event;
    for (ApplicationId appID : appsFinishedEvent.getAppsToCleanup()) {
      String diagnostic = "";
      if (appsFinishedEvent.getReason() == CMgrCompletedAppsEvent.Reason.ON_SHUTDOWN) {
        diagnostic = "Application killed on shutdown";
      } else if (appsFinishedEvent.getReason() == CMgrCompletedAppsEvent.Reason.BY_RESOURCEMANAGER) {
        diagnostic = "Application killed by ResourceManager";
      }
      try {
        this.context.getNMStateStore().storeFinishedApplication(appID);
      } catch (IOException e) {
        LOG.error("Unable to update application state in store", e);
      }
      this.dispatcher.getEventHandler().handle(
          new ApplicationFinishEvent(appID,
              diagnostic));
    }
    break;
  case FINISH_CONTAINERS:
    CMgrCompletedContainersEvent containersFinishedEvent =
        (CMgrCompletedContainersEvent) event;
    for (ContainerId container : containersFinishedEvent
        .getContainersToCleanup()) {
        this.dispatcher.getEventHandler().handle(
            new ContainerKillEvent(container,
                ContainerExitStatus.KILLED_BY_RESOURCEMANAGER,
                "Container Killed by ResourceManager"));
    }
    break;
  default:
      throw new YarnRuntimeException(
          "Got an unknown ContainerManagerEvent type: " + event.getType());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:ContainerManagerImpl.java

示例2: handle

import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void handle(ContainerManagerEvent event) {
  switch (event.getType()) {
  case FINISH_APPS:
    CMgrCompletedAppsEvent appsFinishedEvent =
        (CMgrCompletedAppsEvent) event;
    for (ApplicationId appID : appsFinishedEvent.getAppsToCleanup()) {
      String diagnostic = "";
      if (appsFinishedEvent.getReason() == CMgrCompletedAppsEvent.Reason.ON_SHUTDOWN) {
        diagnostic = "Application killed on shutdown";
      } else if (appsFinishedEvent.getReason() == CMgrCompletedAppsEvent.Reason.BY_RESOURCEMANAGER) {
        diagnostic = "Application killed by ResourceManager";
      }
      this.dispatcher.getEventHandler().handle(
          new ApplicationFinishEvent(appID,
              diagnostic));
    }
    break;
  case FINISH_CONTAINERS:
    CMgrCompletedContainersEvent containersFinishedEvent =
        (CMgrCompletedContainersEvent) event;
    for (ContainerId container : containersFinishedEvent
        .getContainersToCleanup()) {
        this.dispatcher.getEventHandler().handle(
            new ContainerKillEvent(container,
                "Container Killed by ResourceManager"));
    }
    break;
  default:
      throw new YarnRuntimeException(
          "Got an unknown ContainerManagerEvent type: " + event.getType());
  }
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:35,代码来源:ContainerManagerImpl.java

示例3: handle

import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void handle(ContainerManagerEvent event) {
  switch (event.getType()) {
  case FINISH_APPS:
    CMgrCompletedAppsEvent appsFinishedEvent =
        (CMgrCompletedAppsEvent) event;
    for (ApplicationId appID : appsFinishedEvent.getAppsToCleanup()) {
      String diagnostic = "";
      if (appsFinishedEvent.getReason() == CMgrCompletedAppsEvent.Reason.ON_SHUTDOWN) {
        diagnostic = "Application killed on shutdown";
      } else if (appsFinishedEvent.getReason() == CMgrCompletedAppsEvent.Reason.BY_RESOURCEMANAGER) {
        diagnostic = "Application killed by ResourceManager";
      }
      try {
        this.context.getNMStateStore().storeFinishedApplication(appID);
      } catch (IOException e) {
        LOG.error("Unable to update application state in store", e);
      }
      this.dispatcher.getEventHandler().handle(
          new ApplicationFinishEvent(appID,
              diagnostic));
    }
    break;
  case FINISH_CONTAINERS:
    CMgrCompletedContainersEvent containersFinishedEvent =
        (CMgrCompletedContainersEvent) event;
    for (ContainerId container : containersFinishedEvent
        .getContainersToCleanup()) {
        this.dispatcher.getEventHandler().handle(
            new ContainerKillEvent(container,
                ContainerExitStatus.KILLED_BY_RESOURCEMANAGER,
                "Container Killed by ResourceManager"));
    }
    break;
  case UPDATE_CONTAINERS:
  	LOG.info("get containerUpdateEvents");
  	CMgrUpdateContainersEvent containerUpdateEvents =
  			(CMgrUpdateContainersEvent) event;
  	for(NodeContainerUpdate containerUpdate : containerUpdateEvents.getNodeContainerUpdate()){
  		this.dispatcher.getEventHandler().handle(
  			new ContainerResourceUpdate(containerUpdate.getContainerId(),containerUpdate));
  	}
  	break;
  default:
      throw new YarnRuntimeException(
          "Got an unknown ContainerManagerEvent type: " + event.getType());
  }
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:50,代码来源:ContainerManagerImpl.java


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