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


Java NodeState.equals方法代码示例

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


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

示例1: transition

import org.apache.hadoop.yarn.api.records.NodeState; //导入方法依赖的package包/类
@Override
public void transition(RMNodeImpl rmNode, RMNodeEvent event) {
  // Inform the scheduler
  rmNode.nodeUpdateQueue.clear();
  // If the current state is NodeState.UNHEALTHY
  // Then node is already been removed from the
  // Scheduler
  NodeState initialState = rmNode.getState();
  if (!initialState.equals(NodeState.UNHEALTHY)) {
    rmNode.context.getDispatcher().getEventHandler()
      .handle(new NodeRemovedSchedulerEvent(rmNode));
  }
  rmNode.context.getDispatcher().getEventHandler().handle(
      new NodesListManagerEvent(
          NodesListManagerEventType.NODE_UNUSABLE, rmNode));

  // Deactivate the node
  rmNode.context.getRMNodes().remove(rmNode.nodeId);
  LOG.info("Deactivating Node " + rmNode.nodeId + " as it is now "
      + finalState);
  rmNode.context.getInactiveRMNodes().put(rmNode.nodeId.getHost(), rmNode);

  //Update the metrics
  rmNode.updateMetricsForDeactivatedNode(initialState, finalState);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:RMNodeImpl.java

示例2: reportNodeUnusable

import org.apache.hadoop.yarn.api.records.NodeState; //导入方法依赖的package包/类
/**
 * Report node is UNUSABLE and update metrics.
 * @param rmNode
 * @param finalState
 */
public static void reportNodeUnusable(RMNodeImpl rmNode,
    NodeState finalState) {
  // Inform the scheduler
  rmNode.nodeUpdateQueue.clear();
  // If the current state is NodeState.UNHEALTHY
  // Then node is already been removed from the
  // Scheduler
  NodeState initialState = rmNode.getState();
  if (!initialState.equals(NodeState.UNHEALTHY)) {
    rmNode.context.getDispatcher().getEventHandler()
      .handle(new NodeRemovedSchedulerEvent(rmNode));
  }
  rmNode.context.getDispatcher().getEventHandler().handle(
      new NodesListManagerEvent(
          NodesListManagerEventType.NODE_UNUSABLE, rmNode));

  //Update the metrics
  rmNode.updateMetricsForDeactivatedNode(initialState, finalState);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:RMNodeImpl.java

示例3: NMwaitForState

import org.apache.hadoop.yarn.api.records.NodeState; //导入方法依赖的package包/类
public void NMwaitForState(NodeId nodeid, NodeState finalState)
    throws Exception {
  RMNode node = getRMContext().getRMNodes().get(nodeid);
  Assert.assertNotNull("node shouldn't be null", node);
  int timeoutSecs = 0;
  while (!finalState.equals(node.getState()) && timeoutSecs++ < 20) {
    System.out.println("Node State is : " + node.getState()
        + " Waiting for state : " + finalState);
    Thread.sleep(500);
  }
  System.out.println("Node State is : " + node.getState());
  Assert.assertEquals("Node state is not correct (timedout)", finalState,
      node.getState());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:MockRM.java

示例4: transition

import org.apache.hadoop.yarn.api.records.NodeState; //导入方法依赖的package包/类
@Override
public NodeState transition(RMNodeImpl rmNode, RMNodeEvent event) {

  RMNodeStatusEvent statusEvent = (RMNodeStatusEvent) event;

  // Switch the last heartbeatresponse.
  rmNode.latestNodeHeartBeatResponse = statusEvent.getLatestResponse();

  NodeHealthStatus remoteNodeHealthStatus =
      statusEvent.getNodeHealthStatus();
  rmNode.setHealthReport(remoteNodeHealthStatus.getHealthReport());
  rmNode.setLastHealthReportTime(
      remoteNodeHealthStatus.getLastHealthReportTime());
  rmNode.setAggregatedContainersUtilization(
      statusEvent.getAggregatedContainersUtilization());
  rmNode.setNodeUtilization(statusEvent.getNodeUtilization());
  NodeState initialState = rmNode.getState();
  boolean isNodeDecommissioning =
      initialState.equals(NodeState.DECOMMISSIONING);
  if (!remoteNodeHealthStatus.getIsNodeHealthy()) {
    LOG.info("Node " + rmNode.nodeId +
        " reported UNHEALTHY with details: " +
        remoteNodeHealthStatus.getHealthReport());
    // if a node in decommissioning receives an unhealthy report,
    // it will keep decommissioning.
    if (isNodeDecommissioning) {
      return NodeState.DECOMMISSIONING;
    } else {
      reportNodeUnusable(rmNode, NodeState.UNHEALTHY);
      return NodeState.UNHEALTHY;
    }
  }
  if (isNodeDecommissioning) {
    List<ApplicationId> runningApps = rmNode.getRunningApps();

    List<ApplicationId> keepAliveApps = statusEvent.getKeepAliveAppIds();

    // no running (and keeping alive) app on this node, get it
    // decommissioned.
    // TODO may need to check no container is being scheduled on this node
    // as well.
    if ((runningApps == null || runningApps.size() == 0)
        && (keepAliveApps == null || keepAliveApps.size() == 0)) {
      RMNodeImpl.deactivateNode(rmNode, NodeState.DECOMMISSIONED);
      return NodeState.DECOMMISSIONED;
    }

    // TODO (in YARN-3223) if node in decommissioning, get node resource
    // updated if container get finished (keep available resource to be 0)
  }

  rmNode.handleContainerStatus(statusEvent.getContainers());
  rmNode.handleReportedIncreasedContainers(
      statusEvent.getNMReportedIncreasedContainers());

  List<LogAggregationReport> logAggregationReportsForApps =
      statusEvent.getLogAggregationReportsForApps();
  if (logAggregationReportsForApps != null
      && !logAggregationReportsForApps.isEmpty()) {
    rmNode.handleLogAggregationStatus(logAggregationReportsForApps);
  }

  if(rmNode.nextHeartBeat) {
    rmNode.nextHeartBeat = false;
    rmNode.context.getDispatcher().getEventHandler().handle(
        new NodeUpdateSchedulerEvent(rmNode));
  }

  // Update DTRenewer in secure mode to keep these apps alive. Today this is
  // needed for log-aggregation to finish long after the apps are gone.
  if (UserGroupInformation.isSecurityEnabled()) {
    rmNode.context.getDelegationTokenRenewer().updateKeepAliveApplications(
      statusEvent.getKeepAliveAppIds());
  }

  return initialState;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:78,代码来源:RMNodeImpl.java


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