Package org.apache.hadoop.net

Examples of org.apache.hadoop.net.Node


          }
        }
      }


      Node rack = node.hostNode.getParent();

      nodeContainer = rackToRunnableNodes.get(rack);
      if (nodeContainer != null) {
        synchronized (nodeContainer) {
          /**
 
View Full Code Here


  private void computeStatistics(
    TaskInProgress tip, String host, long inputBytes) {
    int level = this.maxLevel;
    String[] splitLocations = tip.getSplitLocations();
    if (splitLocations.length > 0) {
      Node tracker = topologyCache.getNode(host);
      // find the right level across split locations
      for (String local : splitLocations) {
        Node datanode = topologyCache.getNode(local);
        int newLevel = this.maxLevel;
        if (tracker != null && datanode != null) {
          newLevel = getMatchingLevelForNodes(tracker, datanode, maxLevel);
        }
        if (newLevel < level) {
View Full Code Here

      }
      if (container.isEmpty()) {
        hostToRunnableNode.remove(host);
      }
    }
    Node rack = topologyCache.getNode(host).getParent();
    container = rackToRunnableNode.get(rack);
    if (container != null) {
      container.removeNode(node);
      if (container.isEmpty()) {
        rackToRunnableNode.remove(rack);
View Full Code Here

      }
    } else if (level == LocalityLevel.RACK) {
      Set<Map.Entry<Node, NodeContainer>> rackNodesSet =
        nodeSnapshot.runnableRacks();
      for (Map.Entry<Node, NodeContainer> rackNodes: rackNodesSet) {
        Node rack = rackNodes.getKey();
        NodeContainer nodes = rackNodes.getValue();
        Iterator<ClusterNode> clusterNodeIt = nodes.iterator();
        while (clusterNodeIt.hasNext()) {
          ClusterNode node = clusterNodeIt.next();
          if (!nodeManager.hasEnoughResource(node)) {
View Full Code Here

        grants = sessions[1].getGrantedRequests();
      }

      assertEquals(grants.size(), TstUtils.numCpuPerNode);

      Node wantRack = topologyCache.getNode(h0).getParent();
      for (ResourceGrant grant: grants) {
        if(grant.address.host.equals(h0))
           assertEquals("Data Locality on fully subscribed host", null);

        Node gotRack = topologyCache.getNode(grant.address.host).getParent();
        assertEquals(wantRack, gotRack);
      }

      // free up all the requests on node #0
      cm.releaseResource(handles[0], createIdList(0, TstUtils.numCpuPerNode-1));
View Full Code Here

        if (hostReqs == null) {
          hostReqs = new LinkedList<ResourceRequestInfo>();
          c.hostToPendingRequests.put(host, hostReqs);
        }
        hostReqs.add(req);
        Node rack = node.getRack();
        List<ResourceRequestInfo> rackReqs = c.rackToPendingRequests.get(rack);
        if (rackReqs == null) {
          rackReqs = new LinkedList<ResourceRequestInfo>();
          c.rackToPendingRequests.put(rack, rackReqs);
        }
View Full Code Here

            c.hostToPendingRequests.get(host);
          Utilities.removeReference(hostReqs, req);
          if (hostReqs.isEmpty()) {
            c.hostToPendingRequests.remove(host);
          }
          Node rack = node.getRack();
          List<ResourceRequestInfo> rackReqs =
            c.rackToPendingRequests.get(rack);
          Utilities.removeReference(rackReqs, req);
          if (rackReqs.isEmpty()) {
            c.rackToPendingRequests.remove(rack);
View Full Code Here

        }

        if (chosenNode == null)
          continue;

        Node oldNode = excludedNodes.put(chosenNode, chosenNode);
        if (oldNode == null) { // choosendNode was not in the excluded list
          if (isGoodTarget(chosenNode, blocksize, maxReplicasPerRack, results)) {
            results.add(chosenNode);
            return true;
          }
View Full Code Here

    if (localMachine == null)
      return chooseRandom(NodeBase.ROOT, excludedNodes,
                          blocksize, maxNodesPerRack, results);
     
    // otherwise try local machine first
    Node oldNode = excludedNodes.put(localMachine, localMachine);
    if (oldNode == null) { // was not in the excluded list
      if (isGoodTarget(localMachine, blocksize,
                       maxNodesPerRack, false, results)) {
        results.add(localMachine);
        return localMachine;
View Full Code Here

      clusterMap.countNumOfAvailableNodes(nodes, excludedNodes.keySet());
    while(numOfAvailableNodes > 0) {
      DatanodeDescriptor chosenNode =
        (DatanodeDescriptor)(clusterMap.chooseRandom(nodes));

      Node oldNode = excludedNodes.put(chosenNode, chosenNode);
      if (oldNode == null) { // choosendNode was not in the excluded list
        numOfAvailableNodes--;
        if (isGoodTarget(chosenNode, blocksize, maxNodesPerRack, results)) {
          results.add(chosenNode);
          return chosenNode;
View Full Code Here

TOP

Related Classes of org.apache.hadoop.net.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.