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


Java NodeState.DECOMMISSIONING属性代码示例

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


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

示例1: refreshNodesGracefully

/**
 * Refresh the nodes gracefully
 *
 * @param conf
 * @throws IOException
 * @throws YarnException
 */
public void refreshNodesGracefully(Configuration conf) throws IOException,
    YarnException {
  refreshHostsReader(conf);
  for (Entry<NodeId, RMNode> entry:rmContext.getRMNodes().entrySet()) {
    NodeId nodeId = entry.getKey();
    if (!isValidNode(nodeId.getHost())) {
      this.rmContext.getDispatcher().getEventHandler().handle(
          new RMNodeEvent(nodeId, RMNodeEventType.GRACEFUL_DECOMMISSION));
    } else {
      // Recommissioning the nodes
      if (entry.getValue().getState() == NodeState.DECOMMISSIONING
          || entry.getValue().getState() == NodeState.DECOMMISSIONED) {
        this.rmContext.getDispatcher().getEventHandler()
            .handle(new RMNodeEvent(nodeId, RMNodeEventType.RECOMMISSION));
      }
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:NodesListManager.java

示例2: checkForDecommissioningNodes

/**
 * It checks for any nodes in decommissioning state
 *
 * @return decommissioning nodes
 */
public Set<NodeId> checkForDecommissioningNodes() {
  Set<NodeId> decommissioningNodes = new HashSet<NodeId>();
  for (Entry<NodeId, RMNode> entry : rmContext.getRMNodes().entrySet()) {
    if (entry.getValue().getState() == NodeState.DECOMMISSIONING) {
      decommissioningNodes.add(entry.getKey());
    }
  }
  return decommissioningNodes;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:14,代码来源:NodesListManager.java

示例3: refreshNodesForcefully

/**
 * Forcefully decommission the nodes if they are in DECOMMISSIONING state
 */
public void refreshNodesForcefully() {
  for (Entry<NodeId, RMNode> entry : rmContext.getRMNodes().entrySet()) {
    if (entry.getValue().getState() == NodeState.DECOMMISSIONING) {
      this.rmContext.getDispatcher().getEventHandler().handle(
          new RMNodeEvent(entry.getKey(), RMNodeEventType.DECOMMISSION));
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:11,代码来源:NodesListManager.java

示例4: transition

@Override
public NodeState transition(RMNodeImpl rmNode, RMNodeEvent event) {
  RMNodeReconnectEvent reconnectEvent = (RMNodeReconnectEvent) event;
  RMNode newNode = reconnectEvent.getReconnectedNode();
  rmNode.nodeManagerVersion = newNode.getNodeManagerVersion();
  List<ApplicationId> runningApps = reconnectEvent.getRunningApplications();
  boolean noRunningApps = 
      (runningApps == null) || (runningApps.size() == 0);
  
  // No application running on the node, so send node-removal event with 
  // cleaning up old container info.
  if (noRunningApps) {
    if (rmNode.getState() == NodeState.DECOMMISSIONING) {
      // When node in decommissioning, and no running apps on this node,
      // it will return as decommissioned state.
      deactivateNode(rmNode, NodeState.DECOMMISSIONED);
      return NodeState.DECOMMISSIONED;
    }
    rmNode.nodeUpdateQueue.clear();
    rmNode.context.getDispatcher().getEventHandler().handle(
        new NodeRemovedSchedulerEvent(rmNode));

    if (rmNode.getHttpPort() == newNode.getHttpPort()) {
      if (!rmNode.getTotalCapability().equals(
          newNode.getTotalCapability())) {
        rmNode.totalCapability = newNode.getTotalCapability();
      }
      if (rmNode.getState().equals(NodeState.RUNNING)) {
        // Only add old node if old state is RUNNING
        rmNode.context.getDispatcher().getEventHandler().handle(
            new NodeAddedSchedulerEvent(rmNode));
      }
    } else {
      // Reconnected node differs, so replace old node and start new node
      switch (rmNode.getState()) {
        case RUNNING:
          ClusterMetrics.getMetrics().decrNumActiveNodes();
          break;
        case UNHEALTHY:
          ClusterMetrics.getMetrics().decrNumUnhealthyNMs();
          break;
        default:
          LOG.debug("Unexpected Rmnode state");
        }
        rmNode.context.getRMNodes().put(newNode.getNodeID(), newNode);
        rmNode.context.getDispatcher().getEventHandler().handle(
            new RMNodeStartedEvent(newNode.getNodeID(), null, null));
    }

  } else {
    rmNode.httpPort = newNode.getHttpPort();
    rmNode.httpAddress = newNode.getHttpAddress();
    boolean isCapabilityChanged = false;
    if (!rmNode.getTotalCapability().equals(
        newNode.getTotalCapability())) {
      rmNode.totalCapability = newNode.getTotalCapability();
      isCapabilityChanged = true;
    }
  
    handleNMContainerStatus(reconnectEvent.getNMContainerStatuses(), rmNode);

    for (ApplicationId appId : reconnectEvent.getRunningApplications()) {
      handleRunningAppOnNode(rmNode, rmNode.context, appId, rmNode.nodeId);
    }

    if (isCapabilityChanged
        && rmNode.getState().equals(NodeState.RUNNING)) {
      // Update scheduler node's capacity for reconnect node.
      rmNode.context
          .getDispatcher()
          .getEventHandler()
          .handle(
              new NodeResourceUpdateSchedulerEvent(rmNode, ResourceOption
                  .newInstance(newNode.getTotalCapability(), -1)));
    }

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


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