Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-1412

Allocating Containers on a particular Node in Yarn

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.2.0
    • None
    • None
    • None
    • centos, Hadoop 2.2.0

    Description

      Summary of the problem:

      If I pass the node on which I want container and set relax locality default which is true, I don't get back the container on the node specified even if the resources are available on the node. It doesn't matter if I set rack or not.

      Here is the snippet of the code that I am using

      AMRMClient<ContainerRequest> amRmClient = AMRMClient.createAMRMClient();;
      String host = "h1";
      Resource capability = Records.newRecord(Resource.class);
      capability.setMemory(memory);
      nodes = new String[]

      {host}

      ;
      // in order to request a host, we also have to request the rack
      racks = new String[]

      {"/default-rack"}

      ;
      List<ContainerRequest> containerRequests = new ArrayList<ContainerRequest>();
      List<ContainerId> releasedContainers = new ArrayList<ContainerId>();
      containerRequests.add(new ContainerRequest(capability, nodes, racks, Priority.newInstance(priority)));
      if (containerRequests.size() > 0) {
      LOG.info("Asking RM for containers: " + containerRequests);
      for (ContainerRequest cr : containerRequests) {
      LOG.info("Requested container: {}", cr.toString());
      amRmClient.addContainerRequest(cr);
      }
      }

      for (ContainerId containerId : releasedContainers) {
      LOG.info("Released container, id={}", containerId.getId());
      amRmClient.releaseAssignedContainer(containerId);
      }
      return amRmClient.allocate(0);

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gaurav.gopi123 gaurav gupta
              Votes:
              1 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated: