Return-Path: X-Original-To: apmail-hadoop-common-user-archive@www.apache.org Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 58E7910D05 for ; Thu, 14 Nov 2013 06:11:54 +0000 (UTC) Received: (qmail 49088 invoked by uid 500); 14 Nov 2013 06:11:45 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 48995 invoked by uid 500); 14 Nov 2013 06:11:34 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 48988 invoked by uid 99); 14 Nov 2013 06:11:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Nov 2013 06:11:33 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [108.166.43.73] (HELO smtp73.ord1c.emailsrvr.com) (108.166.43.73) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Nov 2013 06:11:26 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 39FFA1E8153 for ; Thu, 14 Nov 2013 01:11:05 -0500 (EST) X-Virus-Scanned: OK Received: by smtp2.relay.ord1c.emailsrvr.com (Authenticated sender: gaurav-AT-datatorrent.com) with ESMTPSA id 09F1A1E8099 for ; Thu, 14 Nov 2013 01:10:31 -0500 (EST) Message-ID: <52846954.6070704@datatorrent.com> Date: Wed, 13 Nov 2013 22:10:28 -0800 From: gaurav User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: user@hadoop.apache.org Subject: Re: Allocating Containers on a particular Node in Yarn References: <52840349.3030108@datatorrent.com> <52840405.6090203@datatorrent.com> <52841725.1050102@datatorrent.com> <52841D9B.3020901@datatorrent.com> <528421B0.8010305@datatorrent.com> <528427A4.6010506@datatorrent.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------020006000901000400080200" X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. --------------020006000901000400080200 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Here is the snippet of code that I am using to allocate containers AMRMClient 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 containerRequests = new ArrayList(); List releasedContainers = new ArrayList(); containerRequests.add(new ContainerRequest(capability, nodes, racks, Priority.newInstance(priority),false)); 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); -Gaurav On 11/13/2013 07:36 PM, Sandy Ryza wrote: > In that case, the AMRMClient code looks correct to me. Can you share > the code you've written against it that's not receiving the correct > containers? > > > On Wed, Nov 13, 2013 at 5:30 PM, gaurav > wrote: > > Hi, > > I looked in the trunk and line numbers are 361 and 366. > > Thanks > -Gaurav > > On 11/13/2013 5:04 PM, gaurav wrote: >> I have hadoop-2.2.0 >> Thanks >> -Gaurav >> On 11/13/2013 4:59 PM, Sandy Ryza wrote: >>> What version are you using? Setting the relax locality to true >>> for nodes is always correct. For racks, this is not necessarily >>> the case. When I look at trunk, it is set to true always on >>> line 361 (which is correct), but on on line 374. >>> >>> -Sandy >>> >>> >>> On Wed, Nov 13, 2013 at 4:47 PM, gaurav >> > wrote: >>> >>> Hi Sandy, >>> >>> No it is not working for me. As mentioned earlier, >>> AMRMClient is not respecting the locality for node and rack >>> in *Line 361 and 374 *and is set to true always. >>> I am requesting for one container with specified node and >>> rack and relaxed locality false. >>> >>> Thanks >>> -Gaurav >>> >>> On 11/13/2013 4:24 PM, Sandy Ryza wrote: >>>> [moving to user list] >>>> >>>> Right. relaxLocality needs to be set on the next level up. >>>> It determines whether locality can be relaxed to that >>>> level. Confusing, I know. If you are using AMRMClient, >>>> you should be able to accomplish what you're looking for by >>>> creating an AMRMClient.ContainerRequest that specifies a >>>> node and sets relax locality to false. Is that not working >>>> for you? >>>> >>>> -Sandy >>>> >>>> >>>> On Wed, Nov 13, 2013 at 4:19 PM, gaurav >>>> > wrote: >>>> >>>> Hi Sandy, >>>> >>>> If I set relaxlocality to true with host name, I don't >>>> get the container on specified host even though node >>>> has the resources. >>>> I am using AMRMClient, only thing is I made following >>>> changes to get the containers on the specified node. >>>> / >>>> //Line: 361 // >>>> //Original// >>>> // addResourceRequest(req.getPriority(), node, >>>> req.getCapability(), req, true);// >>>> //Modifiled// >>>> // addResourceRequest(req.getPriority(), node, >>>> req.getCapability(), req, req.getRelaxLocality());// >>>> // >>>> //Line 374// >>>> //Original// >>>> // addResourceRequest(req.getPriority(), rack, >>>> req.getCapability(), req, true);// >>>> //Modifiled// >>>> // addResourceRequest(req.getPriority(), rack, >>>> req.getCapability(), req, req.getRelaxLocality());// >>>> /// >>>> >>>> >>>> Thanks >>>> -Gaurav >>>> >>>> >>>> On 11/13/2013 4:02 PM, Sandy Ryza wrote: >>>> >>>> Yeah, specifying a host name with relaxLocality is >>>> meaningful. Schedulers >>>> use delay scheduling ( >>>> http://www.cs.berkeley.edu/~matei/talks/2010/eurosys_delaysched.pdf >>>> ) >>>> to >>>> achieve locality when relaxLocality is on. But it >>>> is turned off by >>>> default. The individual scheduler docs have >>>> specifics on how to configure >>>> it. >>>> >>>> Guarav, >>>> Using ResourceRequests directly is not >>>> straightforward and error prone. Is >>>> there a reason that AMRMClient is unsuitable for >>>> your needs? >>>> >>>> -Sandy >>>> >>>> >>>> >>>> On Wed, Nov 13, 2013 at 3:55 PM, Thomas Weise >>>> >>> >wrote: >>>> >>>> Is it possible to specify a particular node and >>>> have RM fallback to an >>>> different node only after making an attempt to >>>> allocate for the requested >>>> node? In other words, is the combination of >>>> specific host name and >>>> relaxLocality=TRUE meaningful at all? >>>> >>>> Thanks. >>>> >>>> >>>> On Wed, Nov 13, 2013 at 3:23 PM, Alejandro >>>> Abdelnur >>> >>>> >>>> wrote: >>>> Gaurav, >>>> >>>> Setting relaxLocality to FALSE should do it. >>>> >>>> thanks. >>>> >>>> >>>> On Wed, Nov 13, 2013 at 2:58 PM, gaurav >>>> >>> > wrote: >>>> >>>> Hi, >>>> I am trying to allocate containers on >>>> a particular node in Yarn but >>>> >>>> Yarn >>>> >>>> is returning me containers on different >>>> node although the requested >>>> >>>> node >>>> >>>> has resources available. >>>> >>>> I checked into the >>>> allocate(AllocateRequest request) >>>> function of >>>> ApplicationMasterService and my request >>>> is as follows >>>> >>>> *request: ask { priority { priority: 1 >>>> } resource_name: "h2" >>>> >>>> capability { >>>> >>>> memory: 1000 } num_containers: 2 } ask >>>> { priority { priority: 1 } >>>> resource_name: "/default-rack" >>>> capability { memory: 1000 } >>>> >>>> num_containers: >>>> >>>> 2 } ask { priority { priority: 1 } >>>> resource_name: "*" capability { >>>> >>>> memory: >>>> >>>> 1000 } num_containers: 2 } response_id: >>>> 1 progress: 0.0* >>>> >>>> but the containers that I am getting >>>> back is as follows >>>> [Container: [ContainerId: >>>> container_1384381084244_0001_01_000002, >>>> >>>> NodeId: >>>> >>>> h1:1234, NodeHttpAddress: h1:2, >>>> Resource: , >>>> Priority: 1, Token: Token { kind: >>>> ContainerToken, service: h1:1234 }, >>>> >>>> ], >>>> >>>> Container: [ContainerId: >>>> container_1384381084244_0001_01_000003, >>>> >>>> NodeId: >>>> >>>> h1:1234, NodeHttpAddress: h1:2, >>>> Resource: , >>>> Priority: 1, Token: Token { kind: >>>> ContainerToken, service: h1:1234 }, >>>> >>>> ]] >>>> >>>> I am attaching the test case that I >>>> have written along with the mail. >>>> >>>> It >>>> >>>> uses classes under >>>> org.apache.hadoop.yarn.server.resourcemanager >>>> >>>> package. >>>> >>>> Any pointers would be of great help >>>> >>>> Thanks >>>> Gaurav >>>> >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> Alejandro >>>> >>>> >>>> >>> >>> >> > > --------------020006000901000400080200 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Here is the snippet of code that I am using to allocate containers

    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),false));
    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);



-Gaurav

On 11/13/2013 07:36 PM, Sandy Ryza wrote:
In that case, the AMRMClient code looks correct to me.  Can you share the code you've written against it that's not receiving the correct containers?


On Wed, Nov 13, 2013 at 5:30 PM, gaurav <gaurav@datatorrent.com> wrote:
Hi,

I looked in the trunk and line numbers are 361 and 366.
Thanks
-Gaurav
On 11/13/2013 5:04 PM, gaurav wrote:
I have hadoop-2.2.0
Thanks
-Gaurav
On 11/13/2013 4:59 PM, Sandy Ryza wrote:
What version are you using?  Setting the relax locality to true for nodes is always correct.  For racks, this is not necessarily the case.  When I look at trunk, it is set to true always on line 361 (which is correct), but on on line 374.

-Sandy


On Wed, Nov 13, 2013 at 4:47 PM, gaurav <gaurav@datatorrent.com> wrote:
Hi Sandy,

No it is not working for me.  As mentioned earlier, AMRMClient is not respecting the locality for node and rack in Line 361 and 374 and is set to true always.
I am requesting for one container with specified node and rack and relaxed locality false.
Thanks
-Gaurav
On 11/13/2013 4:24 PM, Sandy Ryza wrote:
[moving to user list]

Right.  relaxLocality needs to be set on the next level up.  It determines whether locality can be relaxed to that level.  Confusing, I know.  If you are using AMRMClient, you should be able to accomplish what you're looking for by creating an AMRMClient.ContainerRequest that specifies a node and sets relax locality to false.  Is that not working for you?

-Sandy


On Wed, Nov 13, 2013 at 4:19 PM, gaurav <gaurav@datatorrent.com> wrote:
Hi Sandy,

If I set relaxlocality to true with host name, I don't get the container on specified host even though node has the resources.
I am using AMRMClient, only thing is I made following changes to get the containers on the specified node.
/
//Line: 361 //
//Original//
// addResourceRequest(req.getPriority(), node, req.getCapability(), req, true);//
//Modifiled//
// addResourceRequest(req.getPriority(), node, req.getCapability(), req, req.getRelaxLocality());//
//
//Line 374//
//Original//
// addResourceRequest(req.getPriority(), rack, req.getCapability(), req, true);//
//Modifiled//
// addResourceRequest(req.getPriority(), rack, req.getCapability(), req, req.getRelaxLocality());//
///


Thanks
-Gaurav


On 11/13/2013 4:02 PM, Sandy Ryza wrote:
Yeah, specifying a host name with relaxLocality is meaningful.  Schedulers
use delay scheduling (
http://www.cs.berkeley.edu/~matei/talks/2010/eurosys_delaysched.pdf) to
achieve locality when relaxLocality is on.  But it is turned off by
default.  The individual scheduler docs have specifics on how to configure
it.

Guarav,
Using ResourceRequests directly is not straightforward and error prone.  Is
there a reason that AMRMClient is unsuitable for your needs?

-Sandy



On Wed, Nov 13, 2013 at 3:55 PM, Thomas Weise <thomas.weise@gmail.com>wrote:

Is it possible to specify a particular node and have RM fallback to an
different node only after making an attempt to allocate for the requested
node? In other words, is the combination of specific host name and
relaxLocality=TRUE meaningful at all?

Thanks.


On Wed, Nov 13, 2013 at 3:23 PM, Alejandro Abdelnur <tucu@cloudera.com
wrote:
Gaurav,

Setting relaxLocality to FALSE should do it.

thanks.


On Wed, Nov 13, 2013 at 2:58 PM, gaurav <gaurav@datatorrent.com> wrote:

  Hi,
  I am trying to allocate containers on a particular node in Yarn but
Yarn
is returning me containers on different node although the requested
node
has resources available.

I checked into the allocate(AllocateRequest request) function of
ApplicationMasterService and my request is as follows

*request: ask { priority { priority: 1 } resource_name: "h2"
capability {
memory: 1000 } num_containers: 2 } ask { priority { priority: 1 }
resource_name: "/default-rack" capability { memory: 1000 }
num_containers:
2 } ask { priority { priority: 1 } resource_name: "*" capability {
memory:
1000 } num_containers: 2 } response_id: 1 progress: 0.0*

but the containers that I am getting back is as follows
[Container: [ContainerId: container_1384381084244_0001_01_000002,
NodeId:
h1:1234, NodeHttpAddress: h1:2, Resource: <memory:1024, vCores:1>,
Priority: 1, Token: Token { kind: ContainerToken, service: h1:1234 },
],
Container: [ContainerId: container_1384381084244_0001_01_000003,
NodeId:
h1:1234, NodeHttpAddress: h1:2, Resource: <memory:1024, vCores:1>,
Priority: 1, Token: Token { kind: ContainerToken, service: h1:1234 },
]]
I am attaching the test case that I have written along with the mail.
It
uses classes under org.apache.hadoop.yarn.server.resourcemanager
package.
Any pointers would be of great help

Thanks
Gaurav






--
Alejandro









--------------020006000901000400080200--