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


Java NodeInfo类代码示例

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


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

示例1: getNodes

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo; //导入依赖的package包/类
/**
 * Returns all nodes in the cluster. If the states param is given, returns
 * all nodes that are in the comma-separated list of states.
 */
@GET
@Path("/nodes")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public NodesInfo getNodes(@QueryParam("states") String states) {
  init();
  ResourceScheduler sched = this.rm.getResourceScheduler();
  if (sched == null) {
    throw new NotFoundException("Null ResourceScheduler instance");
  }
  
  EnumSet<NodeState> acceptedStates;
  if (states == null) {
    acceptedStates = EnumSet.allOf(NodeState.class);
  } else {
    acceptedStates = EnumSet.noneOf(NodeState.class);
    for (String stateStr : states.split(",")) {
      acceptedStates.add(
          NodeState.valueOf(StringUtils.toUpperCase(stateStr)));
    }
  }
  
  Collection<RMNode> rmNodes = RMServerUtils.queryRMNodes(this.rm.getRMContext(),
      acceptedStates);
  NodesInfo nodesInfo = new NodesInfo();
  for (RMNode rmNode : rmNodes) {
    NodeInfo nodeInfo = new NodeInfo(rmNode, sched);
    if (EnumSet.of(NodeState.LOST, NodeState.DECOMMISSIONED, NodeState.REBOOTED)
        .contains(rmNode.getState())) {
      nodeInfo.setNodeHTTPAddress(EMPTY);
    }
    nodesInfo.add(nodeInfo);
  }
  
  return nodesInfo;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:RMWebServices.java

示例2: getNode

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo; //导入依赖的package包/类
@GET
@Path("/nodes/{nodeId}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public NodeInfo getNode(@PathParam("nodeId") String nodeId) {
  init();
  if (nodeId == null || nodeId.isEmpty()) {
    throw new NotFoundException("nodeId, " + nodeId + ", is empty or null");
  }
  ResourceScheduler sched = this.rm.getResourceScheduler();
  if (sched == null) {
    throw new NotFoundException("Null ResourceScheduler instance");
  }
  NodeId nid = ConverterUtils.toNodeId(nodeId);
  RMNode ni = this.rm.getRMContext().getRMNodes().get(nid);
  boolean isInactive = false;
  if (ni == null) {
    ni = this.rm.getRMContext().getInactiveRMNodes().get(nid.getHost());
    if (ni == null) {
      throw new NotFoundException("nodeId, " + nodeId + ", is not found");
    }
    isInactive = true;
  }
  NodeInfo nodeInfo = new NodeInfo(ni, sched);
  if (isInactive) {
    nodeInfo.setNodeHTTPAddress(EMPTY);
  }
  return nodeInfo;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:RMWebServices.java

示例3: getNode

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo; //导入依赖的package包/类
@GET
@Path("/nodes/{nodeId}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public NodeInfo getNode(@PathParam("nodeId") String nodeId) {
  init();
  if (nodeId == null || nodeId.isEmpty()) {
    throw new NotFoundException("nodeId, " + nodeId + ", is empty or null");
  }
  ResourceScheduler sched = this.rm.getResourceScheduler();
  if (sched == null) {
    throw new NotFoundException("Null ResourceScheduler instance");
  }
  NodeId nid = ConverterUtils.toNodeId(nodeId);
  RMNode ni = this.rm.getRMContext().getRMNodes().get(nid);
  boolean isInactive = false;
  if (ni == null) {
    ni = this.rm.getRMContext().getInactiveRMNodes().get(nid);
    if (ni == null) {
      throw new NotFoundException("nodeId, " + nodeId + ", is not found");
    }
    isInactive = true;
  }
  NodeInfo nodeInfo = new NodeInfo(ni, sched);
  if (isInactive) {
    nodeInfo.setNodeHTTPAddress(EMPTY);
  }
  return nodeInfo;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:29,代码来源:RMWebServices.java

示例4: getNodes

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo; //导入依赖的package包/类
/**
 * Returns all nodes in the cluster. If the states param is given, returns
 * all nodes that are in the comma-separated list of states.
 */
@GET
@Path("/nodes")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public NodesInfo getNodes(@QueryParam("states") String states) {
  init();
  ResourceScheduler sched = this.rm.getResourceScheduler();
  if (sched == null) {
    throw new NotFoundException("Null ResourceScheduler instance");
  }
  
  EnumSet<NodeState> acceptedStates;
  if (states == null) {
    acceptedStates = EnumSet.allOf(NodeState.class);
  } else {
    acceptedStates = EnumSet.noneOf(NodeState.class);
    for (String stateStr : states.split(",")) {
      acceptedStates.add(NodeState.valueOf(stateStr.toUpperCase()));
    }
  }
  
  Collection<RMNode> rmNodes = RMServerUtils.queryRMNodes(this.rm.getRMContext(),
      acceptedStates);
  NodesInfo nodesInfo = new NodesInfo();
  for (RMNode rmNode : rmNodes) {
    NodeInfo nodeInfo = new NodeInfo(rmNode, sched);
    if (EnumSet.of(NodeState.LOST, NodeState.DECOMMISSIONED, NodeState.REBOOTED)
        .contains(rmNode.getState())) {
      nodeInfo.setNodeHTTPAddress(EMPTY);
    }
    nodesInfo.add(nodeInfo);
  }
  
  return nodesInfo;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:39,代码来源:RMWebServices.java

示例5: getNode

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo; //导入依赖的package包/类
@GET
@Path("/nodes/{nodeId}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public NodeInfo getNode(@PathParam("nodeId") String nodeId) {
  init();
  if (nodeId == null || nodeId.isEmpty()) {
    throw new NotFoundException("nodeId, " + nodeId + ", is empty or null");
  }
  ResourceScheduler sched = this.rm.getResourceScheduler();
  if (sched == null) {
    throw new NotFoundException("Null ResourceScheduler instance");
  }
  NodeId nid = NodeId.fromString(nodeId);
  RMNode ni = this.rm.getRMContext().getRMNodes().get(nid);
  boolean isInactive = false;
  if (ni == null) {
    ni = this.rm.getRMContext().getInactiveRMNodes().get(nid);
    if (ni == null) {
      throw new NotFoundException("nodeId, " + nodeId + ", is not found");
    }
    isInactive = true;
  }
  NodeInfo nodeInfo = new NodeInfo(ni, sched);
  if (isInactive) {
    nodeInfo.setNodeHTTPAddress(EMPTY);
  }
  return nodeInfo;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:29,代码来源:RMWebServices.java

示例6: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo; //导入依赖的package包/类
@Override
protected void render(Block html) {
  html._(MetricsOverviewTable.class);

  ResourceScheduler sched = rm.getResourceScheduler();
  String type = $(NODE_STATE);
  TBODY<TABLE<Hamlet>> tbody = html.table("#nodes").
      thead().
      tr().
      th(".rack", "Rack").
      th(".state", "Node State").
      th(".nodeaddress", "Node Address").
      th(".nodehttpaddress", "Node HTTP Address").
      th(".lastHealthUpdate", "Last health-update").
      th(".healthReport", "Health-report").
      th(".containers", "Containers").
      th(".mem", "Mem Used").
      th(".mem", "Mem Avail").
      _()._().
      tbody();
  NodeState stateFilter = null;
  if(type != null && !type.isEmpty()) {
    stateFilter = NodeState.valueOf(type.toUpperCase());
  }
  Collection<RMNode> rmNodes = this.rmContext.getRMNodes().values();
  boolean isInactive = false;
  if (stateFilter != null) {
    switch (stateFilter) {
    case DECOMMISSIONED:
    case LOST:
    case REBOOTED:
      rmNodes = this.rmContext.getInactiveRMNodes().values();
      isInactive = true;
      break;
    }
  }
  for (RMNode ni : rmNodes) {
    if(stateFilter != null) {
      NodeState state = ni.getState();
      if(!stateFilter.equals(state)) {
        continue;
      }
    } else {
      // No filter. User is asking for all nodes. Make sure you skip the
      // unhealthy nodes.
      if (ni.getState() == NodeState.UNHEALTHY) {
        continue;
      }
    }
    NodeInfo info = new NodeInfo(ni, sched);
    int usedMemory = (int)info.getUsedMemory();
    int availableMemory = (int)info.getAvailableMemory();
    TR<TBODY<TABLE<Hamlet>>> row = tbody.tr().
        td(info.getRack()).
        td(info.getState()).
        td(info.getNodeId());
    if (isInactive) {
      row.td()._("N/A")._();
    } else {
      String httpAddress = info.getNodeHTTPAddress();
      row.td().a(HttpConfig.getSchemePrefix() + httpAddress,
          httpAddress)._();
    }
    row.td().br().$title(String.valueOf(info.getLastHealthUpdate()))._().
          _(Times.format(info.getLastHealthUpdate()))._().
        td(info.getHealthReport()).
        td(String.valueOf(info.getNumContainers())).
        td().br().$title(String.valueOf(usedMemory))._().
          _(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))._().
        td().br().$title(String.valueOf(usedMemory))._().
          _(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))._().
        _();
  }
  tbody._()._();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:76,代码来源:NodesPage.java

示例7: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo; //导入依赖的package包/类
@Override
   protected void render(Block html) {
     html._(MetricsOverviewTable.class);

     ResourceScheduler sched = rm.getResourceScheduler();
     String type = $(NODE_STATE);
     TBODY<TABLE<Hamlet>> tbody = html.table("#nodes").
         thead().
         tr().
         th(".rack", "Rack").
         th(".state", "Node State").
         th(".nodeaddress", "Node Address").
         th(".nodehttpaddress", "Node HTTP Address").
         th(".lastHealthUpdate", "Last health-update").
         th(".healthReport", "Health-report").
         th(".containers", "Containers").
         th(".mem", "Mem Used").
         th(".mem", "Mem Avail").
         _()._().
         tbody();
     NodeState stateFilter = null;
     if(type != null && !type.isEmpty()) {
       stateFilter = NodeState.valueOf(type.toUpperCase());
     }
     Collection<RMNode> rmNodes = this.rmContext.getRMNodes().values();
     boolean isInactive = false;
     if (stateFilter != null) {
       switch (stateFilter) {
       case DECOMMISSIONED:
       case LOST:
       case REBOOTED:
         rmNodes = this.rmContext.getInactiveRMNodes().values();
         isInactive = true;
         break;
       }
     }
     for (RMNode ni : rmNodes) {
       if(stateFilter != null) {
         NodeState state = ni.getState();
         if(!stateFilter.equals(state)) {
           continue;
         }
       } else {
         // No filter. User is asking for all nodes. Make sure you skip the
         // unhealthy nodes.
//Add by ME
         if (ni.getState() == NodeState.UNHEALTHY || ni.getState() == NodeState.UNTRUST) {
           continue;
         }
       }
       NodeInfo info = new NodeInfo(ni, sched);
       int usedMemory = (int)info.getUsedMemory();
       int availableMemory = (int)info.getAvailableMemory();
       TR<TBODY<TABLE<Hamlet>>> row = tbody.tr().
           td(info.getRack()).
           td(info.getState()).
           td(info.getNodeId());
       if (isInactive) {
         row.td()._("N/A")._();
       } else {
         String httpAddress = info.getNodeHTTPAddress();
         row.td().a(HttpConfig.getSchemePrefix() + httpAddress,
             httpAddress)._();
       }
       row.td().br().$title(String.valueOf(info.getLastHealthUpdate()))._().
             _(Times.format(info.getLastHealthUpdate()))._().
           td(info.getHealthReport()).
           td(String.valueOf(info.getNumContainers())).
           td().br().$title(String.valueOf(usedMemory))._().
             _(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))._().
           td().br().$title(String.valueOf(usedMemory))._().
             _(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))._().
           _();
     }
     tbody._()._();
   }
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:77,代码来源:NodesPage.java

示例8: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo; //导入依赖的package包/类
@Override
protected void render(Block html) {
  html._(MetricsOverviewTable.class);

  ResourceScheduler sched = rm.getResourceScheduler();
  String type = $(NODE_STATE);
  TBODY<TABLE<Hamlet>> tbody = html.table("#nodes").
      thead().
      tr().
      th(".rack", "Rack").
      th(".state", "Node State").
      th(".nodeaddress", "Node Address").
      th(".nodehttpaddress", "Node HTTP Address").
      th(".lastHealthUpdate", "Last health-update").
      th(".healthReport", "Health-report").
      th(".containers", "Containers").
      th(".mem", "Mem Used").
      th(".mem", "Mem Avail").
      th(".nodeManagerVersion", "Version").
      _()._().
      tbody();
  NodeState stateFilter = null;
  if(type != null && !type.isEmpty()) {
    stateFilter = NodeState.valueOf(type.toUpperCase());
  }
  Collection<RMNode> rmNodes = this.rmContext.getRMNodes().values();
  boolean isInactive = false;
  if (stateFilter != null) {
    switch (stateFilter) {
    case DECOMMISSIONED:
    case LOST:
    case REBOOTED:
      rmNodes = this.rmContext.getInactiveRMNodes().values();
      isInactive = true;
      break;
    }
  }
  for (RMNode ni : rmNodes) {
    if(stateFilter != null) {
      NodeState state = ni.getState();
      if(!stateFilter.equals(state)) {
        continue;
      }
    } else {
      // No filter. User is asking for all nodes. Make sure you skip the
      // unhealthy nodes.
      if (ni.getState() == NodeState.UNHEALTHY) {
        continue;
      }
    }
    NodeInfo info = new NodeInfo(ni, sched);
    int usedMemory = (int)info.getUsedMemory();
    int availableMemory = (int)info.getAvailableMemory();
    TR<TBODY<TABLE<Hamlet>>> row = tbody.tr().
        td(info.getRack()).
        td(info.getState()).
        td(info.getNodeId());
    if (isInactive) {
      row.td()._("N/A")._();
    } else {
      String httpAddress = info.getNodeHTTPAddress();
      row.td().a("//" + httpAddress,
          httpAddress)._();
    }
    row.td().br().$title(String.valueOf(info.getLastHealthUpdate()))._().
          _(Times.format(info.getLastHealthUpdate()))._().
        td(info.getHealthReport()).
        td(String.valueOf(info.getNumContainers())).
        td().br().$title(String.valueOf(usedMemory))._().
          _(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))._().
        td().br().$title(String.valueOf(usedMemory))._().
          _(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))._().
        td(ni.getNodeManagerVersion()).
        _();
  }
  tbody._()._();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:78,代码来源:NodesPage.java


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