You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-dev@hadoop.apache.org by gaurav <ga...@datatorrent.com> on 2013/11/13 23:58:13 UTC

Fwd: Allocating Containers on a particular Node in Yarn

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





RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Arun,

There are following issues

1. If I pass the node on which I want container and set relax locality to
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
2. If I pass the node on which I want container and set relax locality to
false, then the fall back doesn't work when the resources are not available
on the node specified. It doesn't matter if I set rack or not


Bikas,

I updated some logs on the JIRA. Can you please check if that helps?

- Gaurav

-----Original Message-----
From: Bikas Saha [mailto:bikas@hortonworks.com] 
Sent: Tuesday, November 19, 2013 9:30 AM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

I think https://issues.apache.org/jira/browse/YARN-1412 was opened for this.
I am afraid without the RM debug logs it will be hard to diagnose what is
being observed.

Bikas

-----Original Message-----
From: Arun C Murthy [mailto:acm@hortonworks.com]
Sent: Tuesday, November 19, 2013 7:30 AM
To: yarn-dev@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

Sorry, I'm a little lost here.

Can you please summarize the issue you are seeing? I can try help. Thanks.

On Nov 14, 2013, at 7:55 PM, Gaurav Gupta <ga...@datatorrent.com> wrote:

> Even after setting node-locality-delay to 50, it is not working
>
> -----Original Message-----
> From: Gaurav Gupta [mailto:gaurav@datatorrent.com]
> Sent: Thursday, November 14, 2013 7:03 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
>
> There are some other small applications running but the resources are 
> available on every node of cluster so resources should not be problem.
>
> Following is the node-locality-delay setting <property> 
> <name>yarn.scheduler.capacity.node-locality-delay</name>
>     <value>1</value>
>     <description>
>       Number of missed scheduling opportunities after which the 
> CapacityScheduler
>       attempts to schedule rack-local containers.
>       Typically this should be set to number of racks in the cluster,
this
>       feature is disabled by default, set to -1.
>     </description>
>   </property>
>
> I am attaching logs from the Application Master which shows the 
> request being made and resources I am getting back
>
> 2013-11-14 18:48:09,016 main INFO  util.RackResolver
> (RackResolver.java:coreResolve(109)) - Resolved node10.morado.com to 
> /default-rack
> 2013-11-14 18:48:09,017 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=0
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=node10.morado.com
> numContainers=1
> #asks=1
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=/default-rack numContainers=1
> #asks=2
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=* numContainers=1 #asks=3
> 2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
> (StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
> Capability[<memory:8192, vCores:0>]Priority[1]
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=1
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=1 resourceName=* numContainers=1 #asks=4
> 2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
> (StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
> Capability[<memory:8192, vCores:0>]Priority[2]
> 2013-11-14 18:48:09,024 main INFO  util.RackResolver
> (RackResolver.java:coreResolve(109)) - Resolved node18.morado.com to 
> /default-rack
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=2
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=node18.morado.com
> numContainers=1
> #asks=5
> 2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=/default-rack numContainers=1
> #asks=6
> 2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=* numContainers=1 #asks=7
> 2013-11-14 18:48:10,063 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container., 
> containerId=container_1384399307129_0027_01_000002,
> containerNode=node8.morado.com:51530,
> containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
> priority0
> 2013-11-14 18:48:10,218 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container., 
> containerId=container_1384399307129_0027_01_000003,
> containerNode=node8.morado.com:51530,
> containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
> priority1
> 2013-11-14 18:48:10,235 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container., 
> containerId=container_1384399307129_0027_01_000004,
> containerNode=node37.morado.com:50631,
> containerNodeURI=node37.morado.com:8042, containerResourceMemory8192,
> priority2
>
> -Gaurav
>
> -----Original Message-----
> From: Bikas Saha [mailto:bikas@hortonworks.com]
> Sent: Thursday, November 14, 2013 6:37 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
>
> What else is running on the cluster? What is the locality delay value 
> set to? This value is not time. It is the number of node heartbeat to 
> wait before assigning a rack local container. So if those many nodes 
> heartbeated to the RM before the RM could assign a node local machine 
> to that request then it will assign a rack local machine.
>
> It is interesting that if you don't specify the rack, ie. you want the 
> exact machine, even then you are not getting the exact machine. You 
> should either get the exact machine or your request will not be 
> fulfilled. You should never get a different machine. If this is what 
> you observe then please open a bug on Jira and attach the RM logs 
> mentioning the machine name and container id that were erroneous. You 
> will probably have to enable debug logs on the RM before you get the
repro.
>
> Bikas
>
> -----Original Message-----
> From: Gaurav Gupta [mailto:gaurav@datatorrent.com]
> Sent: Thursday, November 14, 2013 5:48 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
>
> Hi Bikas,
>
> With scheduler delay on and relax locality set to true (with and 
> without Requesting the rack), I don't get the containers on the 
> required host. It always assign to different host.
> I am using default Capacity scheduler. Here is the snippet of the code
>
>    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);
>
>
>
> Thanks
> Gaurav
>
> -----Original Message-----
> From: Bikas Saha [mailto:bikas@hortonworks.com]
> Sent: Wednesday, November 13, 2013 7:05 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
>
> What you ask, try on request node and then fallback to others, is the 
> default behavior for current schedulers in yarn. Ie. relaxLocality is 
> true by default.
>
> -----Original Message-----
> From: Thomas Weise [mailto:thomas.weise@gmail.com]
> Sent: Wednesday, November 13, 2013 3:55 PM
> To: yarn-dev@hadoop.apache.org
> Subject: Re: Allocating Containers on a particular Node in Yarn
>
> 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
> <tu...@cloudera.com>wrote:
>
>> Gaurav,
>>
>> Setting relaxLocality to FALSE should do it.
>>
>> thanks.
>>
>>
>> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>>
>
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or 
> entity to which it is addressed and may contain information that is 
> confidential, privileged and exempt from disclosure under applicable 
> law. If the reader of this message is not the intended recipient, you 
> are hereby notified that any printing, copying, dissemination, 
> distribution, disclosure or forwarding of this communication is 
> strictly prohibited. If you have received this communication in error, 
> please contact the sender immediately and delete it from your system.
Thank You.
>
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or 
> entity to which it is addressed and may contain information that is 
> confidential, privileged and exempt from disclosure under applicable 
> law. If the reader of this message is not the intended recipient, you 
> are hereby notified that any printing, copying, dissemination, 
> distribution, disclosure or forwarding of this communication is 
> strictly prohibited. If you have received this communication in error, 
> please contact the sender immediately and delete it from your system.
Thank You.
>
>

--
Arun C. Murthy
Hortonworks Inc.
http://hortonworks.com/



--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader of
this message is not the intended recipient, you are hereby notified that any
printing, copying, dissemination, distribution, disclosure or forwarding of
this communication is strictly prohibited. If you have received this
communication in error, please contact the sender immediately and delete it
from your system. Thank You.

--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader of
this message is not the intended recipient, you are hereby notified that any
printing, copying, dissemination, distribution, disclosure or forwarding of
this communication is strictly prohibited. If you have received this
communication in error, please contact the sender immediately and delete it
from your system. Thank You.


RE: Allocating Containers on a particular Node in Yarn

Posted by Bikas Saha <bi...@hortonworks.com>.
I think https://issues.apache.org/jira/browse/YARN-1412 was opened for
this. I am afraid without the RM debug logs it will be hard to diagnose
what is being observed.

Bikas

-----Original Message-----
From: Arun C Murthy [mailto:acm@hortonworks.com]
Sent: Tuesday, November 19, 2013 7:30 AM
To: yarn-dev@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

Sorry, I'm a little lost here.

Can you please summarize the issue you are seeing? I can try help. Thanks.

On Nov 14, 2013, at 7:55 PM, Gaurav Gupta <ga...@datatorrent.com> wrote:

> Even after setting node-locality-delay to 50, it is not working
>
> -----Original Message-----
> From: Gaurav Gupta [mailto:gaurav@datatorrent.com]
> Sent: Thursday, November 14, 2013 7:03 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
>
> There are some other small applications running but the resources are
> available on every node of cluster so resources should not be problem.
>
> Following is the node-locality-delay setting <property>
> <name>yarn.scheduler.capacity.node-locality-delay</name>
>     <value>1</value>
>     <description>
>       Number of missed scheduling opportunities after which the
> CapacityScheduler
>       attempts to schedule rack-local containers.
>       Typically this should be set to number of racks in the cluster,
this
>       feature is disabled by default, set to -1.
>     </description>
>   </property>
>
> I am attaching logs from the Application Master which shows the
> request being made and resources I am getting back
>
> 2013-11-14 18:48:09,016 main INFO  util.RackResolver
> (RackResolver.java:coreResolve(109)) - Resolved node10.morado.com to
> /default-rack
> 2013-11-14 18:48:09,017 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=0
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=node10.morado.com
> numContainers=1
> #asks=1
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=/default-rack numContainers=1
> #asks=2
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=* numContainers=1 #asks=3
> 2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
> (StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
> Capability[<memory:8192, vCores:0>]Priority[1]
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=1
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=1 resourceName=* numContainers=1 #asks=4
> 2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
> (StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
> Capability[<memory:8192, vCores:0>]Priority[2]
> 2013-11-14 18:48:09,024 main INFO  util.RackResolver
> (RackResolver.java:coreResolve(109)) - Resolved node18.morado.com to
> /default-rack
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=2
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=node18.morado.com
> numContainers=1
> #asks=5
> 2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=/default-rack numContainers=1
> #asks=6
> 2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=* numContainers=1 #asks=7
> 2013-11-14 18:48:10,063 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container.,
> containerId=container_1384399307129_0027_01_000002,
> containerNode=node8.morado.com:51530,
> containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
> priority0
> 2013-11-14 18:48:10,218 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container.,
> containerId=container_1384399307129_0027_01_000003,
> containerNode=node8.morado.com:51530,
> containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
> priority1
> 2013-11-14 18:48:10,235 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container.,
> containerId=container_1384399307129_0027_01_000004,
> containerNode=node37.morado.com:50631,
> containerNodeURI=node37.morado.com:8042, containerResourceMemory8192,
> priority2
>
> -Gaurav
>
> -----Original Message-----
> From: Bikas Saha [mailto:bikas@hortonworks.com]
> Sent: Thursday, November 14, 2013 6:37 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
>
> What else is running on the cluster? What is the locality delay value
> set to? This value is not time. It is the number of node heartbeat to
> wait before assigning a rack local container. So if those many nodes
> heartbeated to the RM before the RM could assign a node local machine
> to that request then it will assign a rack local machine.
>
> It is interesting that if you don't specify the rack, ie. you want the
> exact machine, even then you are not getting the exact machine. You
> should either get the exact machine or your request will not be
> fulfilled. You should never get a different machine. If this is what
> you observe then please open a bug on Jira and attach the RM logs
> mentioning the machine name and container id that were erroneous. You
> will probably have to enable debug logs on the RM before you get the
repro.
>
> Bikas
>
> -----Original Message-----
> From: Gaurav Gupta [mailto:gaurav@datatorrent.com]
> Sent: Thursday, November 14, 2013 5:48 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
>
> Hi Bikas,
>
> With scheduler delay on and relax locality set to true (with and
> without Requesting the rack), I don't get the containers on the
> required host. It always assign to different host.
> I am using default Capacity scheduler. Here is the snippet of the code
>
>    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);
>
>
>
> Thanks
> Gaurav
>
> -----Original Message-----
> From: Bikas Saha [mailto:bikas@hortonworks.com]
> Sent: Wednesday, November 13, 2013 7:05 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
>
> What you ask, try on request node and then fallback to others, is the
> default behavior for current schedulers in yarn. Ie. relaxLocality is
> true by default.
>
> -----Original Message-----
> From: Thomas Weise [mailto:thomas.weise@gmail.com]
> Sent: Wednesday, November 13, 2013 3:55 PM
> To: yarn-dev@hadoop.apache.org
> Subject: Re: Allocating Containers on a particular Node in Yarn
>
> 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
> <tu...@cloudera.com>wrote:
>
>> Gaurav,
>>
>> Setting relaxLocality to FALSE should do it.
>>
>> thanks.
>>
>>
>> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>>
>
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or
> entity to which it is addressed and may contain information that is
> confidential, privileged and exempt from disclosure under applicable
> law. If the reader of this message is not the intended recipient, you
> are hereby notified that any printing, copying, dissemination,
> distribution, disclosure or forwarding of this communication is
> strictly prohibited. If you have received this communication in error,
> please contact the sender immediately and delete it from your system.
Thank You.
>
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or
> entity to which it is addressed and may contain information that is
> confidential, privileged and exempt from disclosure under applicable
> law. If the reader of this message is not the intended recipient, you
> are hereby notified that any printing, copying, dissemination,
> distribution, disclosure or forwarding of this communication is
> strictly prohibited. If you have received this communication in error,
> please contact the sender immediately and delete it from your system.
Thank You.
>
>

--
Arun C. Murthy
Hortonworks Inc.
http://hortonworks.com/



--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity
to which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby notified
that any printing, copying, dissemination, distribution, disclosure or
forwarding of this communication is strictly prohibited. If you have
received this communication in error, please contact the sender
immediately and delete it from your system. Thank You.

-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.

Re: Allocating Containers on a particular Node in Yarn

Posted by Arun C Murthy <ac...@hortonworks.com>.
Sorry, I'm a little lost here.

Can you please summarize the issue you are seeing? I can try help. Thanks.

On Nov 14, 2013, at 7:55 PM, Gaurav Gupta <ga...@datatorrent.com> wrote:

> Even after setting node-locality-delay to 50, it is not working
> 
> -----Original Message-----
> From: Gaurav Gupta [mailto:gaurav@datatorrent.com] 
> Sent: Thursday, November 14, 2013 7:03 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
> 
> There are some other small applications running but the resources are
> available on every node of cluster so resources should not be problem.
> 
> Following is the node-locality-delay setting <property>
> <name>yarn.scheduler.capacity.node-locality-delay</name>
>     <value>1</value>
>     <description>
>       Number of missed scheduling opportunities after which the
> CapacityScheduler
>       attempts to schedule rack-local containers.
>       Typically this should be set to number of racks in the cluster, this
>       feature is disabled by default, set to -1.
>     </description>
>   </property>
> 
> I am attaching logs from the Application Master which shows the request
> being made and resources I am getting back
> 
> 2013-11-14 18:48:09,016 main INFO  util.RackResolver
> (RackResolver.java:coreResolve(109)) - Resolved node10.morado.com to
> /default-rack
> 2013-11-14 18:48:09,017 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=0
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=node10.morado.com numContainers=1
> #asks=1
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=/default-rack numContainers=1 #asks=2
> 2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=0 resourceName=* numContainers=1 #asks=3
> 2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
> (StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
> Capability[<memory:8192, vCores:0>]Priority[1]
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=1
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=1 resourceName=* numContainers=1 #asks=4
> 2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
> (StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
> Capability[<memory:8192, vCores:0>]Priority[2]
> 2013-11-14 18:48:09,024 main INFO  util.RackResolver
> (RackResolver.java:coreResolve(109)) - Resolved node18.morado.com to
> /default-rack
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(540)) - Added priority=2
> 2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=node18.morado.com numContainers=1
> #asks=5
> 2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=/default-rack numContainers=1 #asks=6
> 2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
> (AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
> applicationId= priority=2 resourceName=* numContainers=1 #asks=7
> 2013-11-14 18:48:10,063 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container.,
> containerId=container_1384399307129_0027_01_000002,
> containerNode=node8.morado.com:51530,
> containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
> priority0
> 2013-11-14 18:48:10,218 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container.,
> containerId=container_1384399307129_0027_01_000003,
> containerNode=node8.morado.com:51530,
> containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
> priority1
> 2013-11-14 18:48:10,235 main INFO  stram.StramAppMaster
> (StramAppMaster.java:execute(764)) - Got new container.,
> containerId=container_1384399307129_0027_01_000004,
> containerNode=node37.morado.com:50631,
> containerNodeURI=node37.morado.com:8042, containerResourceMemory8192,
> priority2
> 
> -Gaurav
> 
> -----Original Message-----
> From: Bikas Saha [mailto:bikas@hortonworks.com]
> Sent: Thursday, November 14, 2013 6:37 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
> 
> What else is running on the cluster? What is the locality delay value set
> to? This value is not time. It is the number of node heartbeat to wait
> before assigning a rack local container. So if those many nodes heartbeated
> to the RM before the RM could assign a node local machine to that request
> then it will assign a rack local machine.
> 
> It is interesting that if you don't specify the rack, ie. you want the exact
> machine, even then you are not getting the exact machine. You should either
> get the exact machine or your request will not be fulfilled. You should
> never get a different machine. If this is what you observe then please open
> a bug on Jira and attach the RM logs mentioning the machine name and
> container id that were erroneous. You will probably have to enable debug
> logs on the RM before you get the repro.
> 
> Bikas
> 
> -----Original Message-----
> From: Gaurav Gupta [mailto:gaurav@datatorrent.com]
> Sent: Thursday, November 14, 2013 5:48 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
> 
> Hi Bikas,
> 
> With scheduler delay on and relax locality set to true (with and without
> Requesting the rack), I don't get the containers on the required host. It
> always assign to different host.
> I am using default Capacity scheduler. Here is the snippet of the code
> 
>    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);
> 
> 
> 
> Thanks
> Gaurav
> 
> -----Original Message-----
> From: Bikas Saha [mailto:bikas@hortonworks.com]
> Sent: Wednesday, November 13, 2013 7:05 PM
> To: yarn-dev@hadoop.apache.org
> Subject: RE: Allocating Containers on a particular Node in Yarn
> 
> What you ask, try on request node and then fallback to others, is the
> default behavior for current schedulers in yarn. Ie. relaxLocality is true
> by default.
> 
> -----Original Message-----
> From: Thomas Weise [mailto:thomas.weise@gmail.com]
> Sent: Wednesday, November 13, 2013 3:55 PM
> To: yarn-dev@hadoop.apache.org
> Subject: Re: Allocating Containers on a particular Node in Yarn
> 
> 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
> <tu...@cloudera.com>wrote:
> 
>> Gaurav,
>> 
>> Setting relaxLocality to FALSE should do it.
>> 
>> thanks.
>> 
>> 
>> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>> 
> 
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or entity to
> which it is addressed and may contain information that is confidential,
> privileged and exempt from disclosure under applicable law. If the reader of
> this message is not the intended recipient, you are hereby notified that any
> printing, copying, dissemination, distribution, disclosure or forwarding of
> this communication is strictly prohibited. If you have received this
> communication in error, please contact the sender immediately and delete it
> from your system. Thank You.
> 
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or entity to
> which it is addressed and may contain information that is confidential,
> privileged and exempt from disclosure under applicable law. If the reader of
> this message is not the intended recipient, you are hereby notified that any
> printing, copying, dissemination, distribution, disclosure or forwarding of
> this communication is strictly prohibited. If you have received this
> communication in error, please contact the sender immediately and delete it
> from your system. Thank You.
> 
> 

--
Arun C. Murthy
Hortonworks Inc.
http://hortonworks.com/



-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.

RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Even after setting node-locality-delay to 50, it is not working

-----Original Message-----
From: Gaurav Gupta [mailto:gaurav@datatorrent.com] 
Sent: Thursday, November 14, 2013 7:03 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

There are some other small applications running but the resources are
available on every node of cluster so resources should not be problem.

Following is the node-locality-delay setting <property>
<name>yarn.scheduler.capacity.node-locality-delay</name>
     <value>1</value>
     <description>
       Number of missed scheduling opportunities after which the
CapacityScheduler
       attempts to schedule rack-local containers.
       Typically this should be set to number of racks in the cluster, this
       feature is disabled by default, set to -1.
     </description>
   </property>

I am attaching logs from the Application Master which shows the request
being made and resources I am getting back

2013-11-14 18:48:09,016 main INFO  util.RackResolver
(RackResolver.java:coreResolve(109)) - Resolved node10.morado.com to
/default-rack
2013-11-14 18:48:09,017 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(540)) - Added priority=0
2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=0 resourceName=node10.morado.com numContainers=1
#asks=1
2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=0 resourceName=/default-rack numContainers=1 #asks=2
2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=0 resourceName=* numContainers=1 #asks=3
2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
(StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
Capability[<memory:8192, vCores:0>]Priority[1]
2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(540)) - Added priority=1
2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=1 resourceName=* numContainers=1 #asks=4
2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
(StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
Capability[<memory:8192, vCores:0>]Priority[2]
2013-11-14 18:48:09,024 main INFO  util.RackResolver
(RackResolver.java:coreResolve(109)) - Resolved node18.morado.com to
/default-rack
2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(540)) - Added priority=2
2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=2 resourceName=node18.morado.com numContainers=1
#asks=5
2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=2 resourceName=/default-rack numContainers=1 #asks=6
2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=2 resourceName=* numContainers=1 #asks=7
2013-11-14 18:48:10,063 main INFO  stram.StramAppMaster
(StramAppMaster.java:execute(764)) - Got new container.,
containerId=container_1384399307129_0027_01_000002,
containerNode=node8.morado.com:51530,
containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
priority0
2013-11-14 18:48:10,218 main INFO  stram.StramAppMaster
(StramAppMaster.java:execute(764)) - Got new container.,
containerId=container_1384399307129_0027_01_000003,
containerNode=node8.morado.com:51530,
containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
priority1
2013-11-14 18:48:10,235 main INFO  stram.StramAppMaster
(StramAppMaster.java:execute(764)) - Got new container.,
containerId=container_1384399307129_0027_01_000004,
containerNode=node37.morado.com:50631,
containerNodeURI=node37.morado.com:8042, containerResourceMemory8192,
priority2

-Gaurav

-----Original Message-----
From: Bikas Saha [mailto:bikas@hortonworks.com]
Sent: Thursday, November 14, 2013 6:37 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

What else is running on the cluster? What is the locality delay value set
to? This value is not time. It is the number of node heartbeat to wait
before assigning a rack local container. So if those many nodes heartbeated
to the RM before the RM could assign a node local machine to that request
then it will assign a rack local machine.

It is interesting that if you don't specify the rack, ie. you want the exact
machine, even then you are not getting the exact machine. You should either
get the exact machine or your request will not be fulfilled. You should
never get a different machine. If this is what you observe then please open
a bug on Jira and attach the RM logs mentioning the machine name and
container id that were erroneous. You will probably have to enable debug
logs on the RM before you get the repro.

Bikas

-----Original Message-----
From: Gaurav Gupta [mailto:gaurav@datatorrent.com]
Sent: Thursday, November 14, 2013 5:48 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

Hi Bikas,

With scheduler delay on and relax locality set to true (with and without
Requesting the rack), I don't get the containers on the required host. It
always assign to different host.
I am using default Capacity scheduler. Here is the snippet of the code

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



Thanks
Gaurav

-----Original Message-----
From: Bikas Saha [mailto:bikas@hortonworks.com]
Sent: Wednesday, November 13, 2013 7:05 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

What you ask, try on request node and then fallback to others, is the
default behavior for current schedulers in yarn. Ie. relaxLocality is true
by default.

-----Original Message-----
From: Thomas Weise [mailto:thomas.weise@gmail.com]
Sent: Wednesday, November 13, 2013 3:55 PM
To: yarn-dev@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

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
<tu...@cloudera.com>wrote:

> Gaurav,
>
> Setting relaxLocality to FALSE should do it.
>
> thanks.
>
>
> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>

--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader of
this message is not the intended recipient, you are hereby notified that any
printing, copying, dissemination, distribution, disclosure or forwarding of
this communication is strictly prohibited. If you have received this
communication in error, please contact the sender immediately and delete it
from your system. Thank You.

--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader of
this message is not the intended recipient, you are hereby notified that any
printing, copying, dissemination, distribution, disclosure or forwarding of
this communication is strictly prohibited. If you have received this
communication in error, please contact the sender immediately and delete it
from your system. Thank You.



RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
There are some other small applications running but the resources are
available on every node of cluster so resources should not be problem.

Following is the node-locality-delay setting
<property>
<name>yarn.scheduler.capacity.node-locality-delay</name>
     <value>1</value>
     <description>
       Number of missed scheduling opportunities after which the
CapacityScheduler
       attempts to schedule rack-local containers.
       Typically this should be set to number of racks in the cluster, this
       feature is disabled by default, set to -1.
     </description>
   </property>

I am attaching logs from the Application Master which shows the request
being made and resources I am getting back

2013-11-14 18:48:09,016 main INFO  util.RackResolver
(RackResolver.java:coreResolve(109)) - Resolved node10.morado.com to
/default-rack
2013-11-14 18:48:09,017 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(540)) - Added priority=0
2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=0 resourceName=node10.morado.com numContainers=1
#asks=1
2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=0 resourceName=/default-rack numContainers=1 #asks=2
2013-11-14 18:48:09,023 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=0 resourceName=* numContainers=1 #asks=3
2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
(StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
Capability[<memory:8192, vCores:0>]Priority[1]
2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(540)) - Added priority=1
2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=1 resourceName=* numContainers=1 #asks=4
2013-11-14 18:48:09,024 main INFO  stram.StramAppMaster
(StramAppMaster.java:sendContainerAskToRM(925)) - Requested container:
Capability[<memory:8192, vCores:0>]Priority[2]
2013-11-14 18:48:09,024 main INFO  util.RackResolver
(RackResolver.java:coreResolve(109)) - Resolved node18.morado.com to
/default-rack
2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(540)) - Added priority=2
2013-11-14 18:48:09,024 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=2 resourceName=node18.morado.com numContainers=1
#asks=5
2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=2 resourceName=/default-rack numContainers=1 #asks=6
2013-11-14 18:48:09,025 main DEBUG impl.AMRMClientImpl
(AMRMClientImpl.java:addResourceRequest(570)) - addResourceRequest:
applicationId= priority=2 resourceName=* numContainers=1 #asks=7
2013-11-14 18:48:10,063 main INFO  stram.StramAppMaster
(StramAppMaster.java:execute(764)) - Got new container.,
containerId=container_1384399307129_0027_01_000002,
containerNode=node8.morado.com:51530,
containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
priority0
2013-11-14 18:48:10,218 main INFO  stram.StramAppMaster
(StramAppMaster.java:execute(764)) - Got new container.,
containerId=container_1384399307129_0027_01_000003,
containerNode=node8.morado.com:51530,
containerNodeURI=node8.morado.com:8042, containerResourceMemory8192,
priority1
2013-11-14 18:48:10,235 main INFO  stram.StramAppMaster
(StramAppMaster.java:execute(764)) - Got new container.,
containerId=container_1384399307129_0027_01_000004,
containerNode=node37.morado.com:50631,
containerNodeURI=node37.morado.com:8042, containerResourceMemory8192,
priority2

-Gaurav

-----Original Message-----
From: Bikas Saha [mailto:bikas@hortonworks.com] 
Sent: Thursday, November 14, 2013 6:37 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

What else is running on the cluster? What is the locality delay value set
to? This value is not time. It is the number of node heartbeat to wait
before assigning a rack local container. So if those many nodes heartbeated
to the RM before the RM could assign a node local machine to that request
then it will assign a rack local machine.

It is interesting that if you don't specify the rack, ie. you want the exact
machine, even then you are not getting the exact machine. You should either
get the exact machine or your request will not be fulfilled. You should
never get a different machine. If this is what you observe then please open
a bug on Jira and attach the RM logs mentioning the machine name and
container id that were erroneous. You will probably have to enable debug
logs on the RM before you get the repro.

Bikas

-----Original Message-----
From: Gaurav Gupta [mailto:gaurav@datatorrent.com]
Sent: Thursday, November 14, 2013 5:48 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

Hi Bikas,

With scheduler delay on and relax locality set to true (with and without
Requesting the rack), I don't get the containers on the required host. It
always assign to different host.
I am using default Capacity scheduler. Here is the snippet of the code

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



Thanks
Gaurav

-----Original Message-----
From: Bikas Saha [mailto:bikas@hortonworks.com]
Sent: Wednesday, November 13, 2013 7:05 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

What you ask, try on request node and then fallback to others, is the
default behavior for current schedulers in yarn. Ie. relaxLocality is true
by default.

-----Original Message-----
From: Thomas Weise [mailto:thomas.weise@gmail.com]
Sent: Wednesday, November 13, 2013 3:55 PM
To: yarn-dev@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

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
<tu...@cloudera.com>wrote:

> Gaurav,
>
> Setting relaxLocality to FALSE should do it.
>
> thanks.
>
>
> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>

--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader of
this message is not the intended recipient, you are hereby notified that any
printing, copying, dissemination, distribution, disclosure or forwarding of
this communication is strictly prohibited. If you have received this
communication in error, please contact the sender immediately and delete it
from your system. Thank You.

--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader of
this message is not the intended recipient, you are hereby notified that any
printing, copying, dissemination, distribution, disclosure or forwarding of
this communication is strictly prohibited. If you have received this
communication in error, please contact the sender immediately and delete it
from your system. Thank You.


RE: Allocating Containers on a particular Node in Yarn

Posted by Bikas Saha <bi...@hortonworks.com>.
What else is running on the cluster? What is the locality delay value set
to? This value is not time. It is the number of node heartbeat to wait
before assigning a rack local container. So if those many nodes
heartbeated to the RM before the RM could assign a node local machine to
that request then it will assign a rack local machine.

It is interesting that if you don't specify the rack, ie. you want the
exact machine, even then you are not getting the exact machine. You should
either get the exact machine or your request will not be fulfilled. You
should never get a different machine. If this is what you observe then
please open a bug on Jira and attach the RM logs mentioning the machine
name and container id that were erroneous. You will probably have to
enable debug logs on the RM before you get the repro.

Bikas

-----Original Message-----
From: Gaurav Gupta [mailto:gaurav@datatorrent.com]
Sent: Thursday, November 14, 2013 5:48 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

Hi Bikas,

With scheduler delay on and relax locality set to true (with and without
Requesting the rack), I don't get the containers on the required host. It
always assign to different host.
I am using default Capacity scheduler. Here is the snippet of the code

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



Thanks
Gaurav

-----Original Message-----
From: Bikas Saha [mailto:bikas@hortonworks.com]
Sent: Wednesday, November 13, 2013 7:05 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

What you ask, try on request node and then fallback to others, is the
default behavior for current schedulers in yarn. Ie. relaxLocality is true
by default.

-----Original Message-----
From: Thomas Weise [mailto:thomas.weise@gmail.com]
Sent: Wednesday, November 13, 2013 3:55 PM
To: yarn-dev@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

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
<tu...@cloudera.com>wrote:

> Gaurav,
>
> Setting relaxLocality to FALSE should do it.
>
> thanks.
>
>
> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>

--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity
to which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby notified
that any printing, copying, dissemination, distribution, disclosure or
forwarding of this communication is strictly prohibited. If you have
received this communication in error, please contact the sender
immediately and delete it from your system. Thank You.

-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.

RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Hi Bikas,

With scheduler delay on and relax locality set to true (with and without
Requesting the rack), I don't get the containers on the required host. It
always assign to different host.
I am using default Capacity scheduler. Here is the snippet of the code

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



Thanks
Gaurav

-----Original Message-----
From: Bikas Saha [mailto:bikas@hortonworks.com] 
Sent: Wednesday, November 13, 2013 7:05 PM
To: yarn-dev@hadoop.apache.org
Subject: RE: Allocating Containers on a particular Node in Yarn

What you ask, try on request node and then fallback to others, is the
default behavior for current schedulers in yarn. Ie. relaxLocality is true
by default.

-----Original Message-----
From: Thomas Weise [mailto:thomas.weise@gmail.com]
Sent: Wednesday, November 13, 2013 3:55 PM
To: yarn-dev@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

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
<tu...@cloudera.com>wrote:

> Gaurav,
>
> Setting relaxLocality to FALSE should do it.
>
> thanks.
>
>
> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>

--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader of
this message is not the intended recipient, you are hereby notified that any
printing, copying, dissemination, distribution, disclosure or forwarding of
this communication is strictly prohibited. If you have received this
communication in error, please contact the sender immediately and delete it
from your system. Thank You.


RE: Allocating Containers on a particular Node in Yarn

Posted by Bikas Saha <bi...@hortonworks.com>.
What you ask, try on request node and then fallback to others, is the
default behavior for current schedulers in yarn. Ie. relaxLocality is true
by default.

-----Original Message-----
From: Thomas Weise [mailto:thomas.weise@gmail.com]
Sent: Wednesday, November 13, 2013 3:55 PM
To: yarn-dev@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

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
<tu...@cloudera.com>wrote:

> Gaurav,
>
> Setting relaxLocality to FALSE should do it.
>
> thanks.
>
>
> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>

-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Yeah, you're right, I meant when locality relaxation is turned off.

I'm not super familiar with the capacity scheduler (more familiar with the
fair scheduler), so maybe someone with knowledge about that can chime in.


On Thu, Nov 14, 2013 at 1:28 PM, Gaurav Gupta <ga...@datatorrent.com>wrote:

> Sandy,
>
>
>
> For the first question you mentioned relaxation locality is turn on, I
> assume you mean that relax locality is set to false right?
>
>
>
> For scheduler, I am using capacity scheduler and modified following
> property in capacity-scheduler.xml
>
> <property>
>
> <name>yarn.scheduler.capacity.node-locality-delay</name>
>
>      <value>1</value>
>
>      <description>
>
>        Number of missed scheduling opportunities after which the
> CapacityScheduler
>
>        attempts to schedule rack-local containers.
>
>        Typically this should be set to number of racks in the cluster, this
>
>        feature is disabled by default, set to -1.
>
>      </description>
>
>    </property>
>
>
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 12:41 PM
>
> *To:* user@hadoop.apache.org
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Great to hear.  Other answers inline
>
>
>
> On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>
> wrote:
>
> Sandy,
>
>
>
> The last trick worked but now I have couple of more questions
>
>
>
> 1.      If I don’t request for rack and relax locality is false with
> scheduler delay on , I see that when I pass a wrong host I don’t get any
> container back. Why so?
>
> When locality relaxation is turned on, we will only ever place the
> container on the host that you requested.  This means that if no such host
> exists, we will never place the container.  This behavior could maybe be
> improved, but there are some tricky issues to deal with there about nodes
> going down and such.
>
> 2.      I also noticed that with scheduler delay on and relax locality
> set to false, If I request for rack along with a host I get one container
> on expected node but not other containers.
>
> 3.      With scheduler delay on and relax locality set to true without
> requesting rack, I don’t get the containers on the required host
>
> What scheduler are you using and what properties are you using to turn the
> scheduler delay on?
>
>
>
> Thanks
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 11:41 AM
> *To:* user@hadoop.apache.org
>
>
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Requesting the rack is not necessary, and is leading to the behavior that
> you're seeing.
>
>
>
> The documentation states:
>
>    * <li>If locality relaxation is disabled, then only within the same
> request,
>
>    * a node and its rack may be specified together. This allows for a
> specific
>
>    * rack with a preference for a specific node within that rack.</li>
>
>
>
>
>
> On Wed, Nov 13, 2013 at 10:10 PM, gaurav <ga...@datatorrent.com> wrote:
>
> 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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Yeah, you're right, I meant when locality relaxation is turned off.

I'm not super familiar with the capacity scheduler (more familiar with the
fair scheduler), so maybe someone with knowledge about that can chime in.


On Thu, Nov 14, 2013 at 1:28 PM, Gaurav Gupta <ga...@datatorrent.com>wrote:

> Sandy,
>
>
>
> For the first question you mentioned relaxation locality is turn on, I
> assume you mean that relax locality is set to false right?
>
>
>
> For scheduler, I am using capacity scheduler and modified following
> property in capacity-scheduler.xml
>
> <property>
>
> <name>yarn.scheduler.capacity.node-locality-delay</name>
>
>      <value>1</value>
>
>      <description>
>
>        Number of missed scheduling opportunities after which the
> CapacityScheduler
>
>        attempts to schedule rack-local containers.
>
>        Typically this should be set to number of racks in the cluster, this
>
>        feature is disabled by default, set to -1.
>
>      </description>
>
>    </property>
>
>
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 12:41 PM
>
> *To:* user@hadoop.apache.org
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Great to hear.  Other answers inline
>
>
>
> On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>
> wrote:
>
> Sandy,
>
>
>
> The last trick worked but now I have couple of more questions
>
>
>
> 1.      If I don’t request for rack and relax locality is false with
> scheduler delay on , I see that when I pass a wrong host I don’t get any
> container back. Why so?
>
> When locality relaxation is turned on, we will only ever place the
> container on the host that you requested.  This means that if no such host
> exists, we will never place the container.  This behavior could maybe be
> improved, but there are some tricky issues to deal with there about nodes
> going down and such.
>
> 2.      I also noticed that with scheduler delay on and relax locality
> set to false, If I request for rack along with a host I get one container
> on expected node but not other containers.
>
> 3.      With scheduler delay on and relax locality set to true without
> requesting rack, I don’t get the containers on the required host
>
> What scheduler are you using and what properties are you using to turn the
> scheduler delay on?
>
>
>
> Thanks
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 11:41 AM
> *To:* user@hadoop.apache.org
>
>
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Requesting the rack is not necessary, and is leading to the behavior that
> you're seeing.
>
>
>
> The documentation states:
>
>    * <li>If locality relaxation is disabled, then only within the same
> request,
>
>    * a node and its rack may be specified together. This allows for a
> specific
>
>    * rack with a preference for a specific node within that rack.</li>
>
>
>
>
>
> On Wed, Nov 13, 2013 at 10:10 PM, gaurav <ga...@datatorrent.com> wrote:
>
> 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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Yeah, you're right, I meant when locality relaxation is turned off.

I'm not super familiar with the capacity scheduler (more familiar with the
fair scheduler), so maybe someone with knowledge about that can chime in.


On Thu, Nov 14, 2013 at 1:28 PM, Gaurav Gupta <ga...@datatorrent.com>wrote:

> Sandy,
>
>
>
> For the first question you mentioned relaxation locality is turn on, I
> assume you mean that relax locality is set to false right?
>
>
>
> For scheduler, I am using capacity scheduler and modified following
> property in capacity-scheduler.xml
>
> <property>
>
> <name>yarn.scheduler.capacity.node-locality-delay</name>
>
>      <value>1</value>
>
>      <description>
>
>        Number of missed scheduling opportunities after which the
> CapacityScheduler
>
>        attempts to schedule rack-local containers.
>
>        Typically this should be set to number of racks in the cluster, this
>
>        feature is disabled by default, set to -1.
>
>      </description>
>
>    </property>
>
>
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 12:41 PM
>
> *To:* user@hadoop.apache.org
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Great to hear.  Other answers inline
>
>
>
> On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>
> wrote:
>
> Sandy,
>
>
>
> The last trick worked but now I have couple of more questions
>
>
>
> 1.      If I don’t request for rack and relax locality is false with
> scheduler delay on , I see that when I pass a wrong host I don’t get any
> container back. Why so?
>
> When locality relaxation is turned on, we will only ever place the
> container on the host that you requested.  This means that if no such host
> exists, we will never place the container.  This behavior could maybe be
> improved, but there are some tricky issues to deal with there about nodes
> going down and such.
>
> 2.      I also noticed that with scheduler delay on and relax locality
> set to false, If I request for rack along with a host I get one container
> on expected node but not other containers.
>
> 3.      With scheduler delay on and relax locality set to true without
> requesting rack, I don’t get the containers on the required host
>
> What scheduler are you using and what properties are you using to turn the
> scheduler delay on?
>
>
>
> Thanks
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 11:41 AM
> *To:* user@hadoop.apache.org
>
>
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Requesting the rack is not necessary, and is leading to the behavior that
> you're seeing.
>
>
>
> The documentation states:
>
>    * <li>If locality relaxation is disabled, then only within the same
> request,
>
>    * a node and its rack may be specified together. This allows for a
> specific
>
>    * rack with a preference for a specific node within that rack.</li>
>
>
>
>
>
> On Wed, Nov 13, 2013 at 10:10 PM, gaurav <ga...@datatorrent.com> wrote:
>
> 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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Yeah, you're right, I meant when locality relaxation is turned off.

I'm not super familiar with the capacity scheduler (more familiar with the
fair scheduler), so maybe someone with knowledge about that can chime in.


On Thu, Nov 14, 2013 at 1:28 PM, Gaurav Gupta <ga...@datatorrent.com>wrote:

> Sandy,
>
>
>
> For the first question you mentioned relaxation locality is turn on, I
> assume you mean that relax locality is set to false right?
>
>
>
> For scheduler, I am using capacity scheduler and modified following
> property in capacity-scheduler.xml
>
> <property>
>
> <name>yarn.scheduler.capacity.node-locality-delay</name>
>
>      <value>1</value>
>
>      <description>
>
>        Number of missed scheduling opportunities after which the
> CapacityScheduler
>
>        attempts to schedule rack-local containers.
>
>        Typically this should be set to number of racks in the cluster, this
>
>        feature is disabled by default, set to -1.
>
>      </description>
>
>    </property>
>
>
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 12:41 PM
>
> *To:* user@hadoop.apache.org
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Great to hear.  Other answers inline
>
>
>
> On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>
> wrote:
>
> Sandy,
>
>
>
> The last trick worked but now I have couple of more questions
>
>
>
> 1.      If I don’t request for rack and relax locality is false with
> scheduler delay on , I see that when I pass a wrong host I don’t get any
> container back. Why so?
>
> When locality relaxation is turned on, we will only ever place the
> container on the host that you requested.  This means that if no such host
> exists, we will never place the container.  This behavior could maybe be
> improved, but there are some tricky issues to deal with there about nodes
> going down and such.
>
> 2.      I also noticed that with scheduler delay on and relax locality
> set to false, If I request for rack along with a host I get one container
> on expected node but not other containers.
>
> 3.      With scheduler delay on and relax locality set to true without
> requesting rack, I don’t get the containers on the required host
>
> What scheduler are you using and what properties are you using to turn the
> scheduler delay on?
>
>
>
> Thanks
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 11:41 AM
> *To:* user@hadoop.apache.org
>
>
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Requesting the rack is not necessary, and is leading to the behavior that
> you're seeing.
>
>
>
> The documentation states:
>
>    * <li>If locality relaxation is disabled, then only within the same
> request,
>
>    * a node and its rack may be specified together. This allows for a
> specific
>
>    * rack with a preference for a specific node within that rack.</li>
>
>
>
>
>
> On Wed, Nov 13, 2013 at 10:10 PM, gaurav <ga...@datatorrent.com> wrote:
>
> 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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Sandy,

 

For the first question you mentioned relaxation locality is turn on, I
assume you mean that relax locality is set to false right?

 

For scheduler, I am using capacity scheduler and modified following property
in capacity-scheduler.xml

<property>

<name>yarn.scheduler.capacity.node-locality-delay</name>

     <value>1</value>

     <description>

       Number of missed scheduling opportunities after which the
CapacityScheduler

       attempts to schedule rack-local containers.

       Typically this should be set to number of racks in the cluster, this

       feature is disabled by default, set to -1.

     </description>

   </property>

 

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 12:41 PM
To: user@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

 

Great to hear.  Other answers inline

 

On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>
wrote:

Sandy,

 

The last trick worked but now I have couple of more questions

 

1.      If I don't request for rack and relax locality is false with
scheduler delay on , I see that when I pass a wrong host I don't get any
container back. Why so?

When locality relaxation is turned on, we will only ever place the container
on the host that you requested.  This means that if no such host exists, we
will never place the container.  This behavior could maybe be improved, but
there are some tricky issues to deal with there about nodes going down and
such. 

2.      I also noticed that with scheduler delay on and relax locality set
to false, If I request for rack along with a host I get one container on
expected node but not other containers. 

3.      With scheduler delay on and relax locality set to true without
requesting rack, I don't get the containers on the required host

What scheduler are you using and what properties are you using to turn the
scheduler delay on? 

 

Thanks

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 11:41 AM
To: user@hadoop.apache.org


Subject: Re: Allocating Containers on a particular Node in Yarn

 

Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

 

The documentation states:

   * <li>If locality relaxation is disabled, then only within the same
request,  

   * a node and its rack may be specified together. This allows for a
specific   

   * rack with a preference for a specific node within that rack.</li>

 

 

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

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 <ga...@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 <ga...@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 <ga...@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
<http://www.cs.berkeley.edu/%7Ematei/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 <th...@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 <ga...@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

 

 

 

 

 

 

 

 

 

 


RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Sandy,

 

For the first question you mentioned relaxation locality is turn on, I
assume you mean that relax locality is set to false right?

 

For scheduler, I am using capacity scheduler and modified following property
in capacity-scheduler.xml

<property>

<name>yarn.scheduler.capacity.node-locality-delay</name>

     <value>1</value>

     <description>

       Number of missed scheduling opportunities after which the
CapacityScheduler

       attempts to schedule rack-local containers.

       Typically this should be set to number of racks in the cluster, this

       feature is disabled by default, set to -1.

     </description>

   </property>

 

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 12:41 PM
To: user@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

 

Great to hear.  Other answers inline

 

On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>
wrote:

Sandy,

 

The last trick worked but now I have couple of more questions

 

1.      If I don't request for rack and relax locality is false with
scheduler delay on , I see that when I pass a wrong host I don't get any
container back. Why so?

When locality relaxation is turned on, we will only ever place the container
on the host that you requested.  This means that if no such host exists, we
will never place the container.  This behavior could maybe be improved, but
there are some tricky issues to deal with there about nodes going down and
such. 

2.      I also noticed that with scheduler delay on and relax locality set
to false, If I request for rack along with a host I get one container on
expected node but not other containers. 

3.      With scheduler delay on and relax locality set to true without
requesting rack, I don't get the containers on the required host

What scheduler are you using and what properties are you using to turn the
scheduler delay on? 

 

Thanks

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 11:41 AM
To: user@hadoop.apache.org


Subject: Re: Allocating Containers on a particular Node in Yarn

 

Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

 

The documentation states:

   * <li>If locality relaxation is disabled, then only within the same
request,  

   * a node and its rack may be specified together. This allows for a
specific   

   * rack with a preference for a specific node within that rack.</li>

 

 

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

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 <ga...@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 <ga...@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 <ga...@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
<http://www.cs.berkeley.edu/%7Ematei/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 <th...@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 <ga...@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

 

 

 

 

 

 

 

 

 

 


RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Sandy,

 

For the first question you mentioned relaxation locality is turn on, I
assume you mean that relax locality is set to false right?

 

For scheduler, I am using capacity scheduler and modified following property
in capacity-scheduler.xml

<property>

<name>yarn.scheduler.capacity.node-locality-delay</name>

     <value>1</value>

     <description>

       Number of missed scheduling opportunities after which the
CapacityScheduler

       attempts to schedule rack-local containers.

       Typically this should be set to number of racks in the cluster, this

       feature is disabled by default, set to -1.

     </description>

   </property>

 

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 12:41 PM
To: user@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

 

Great to hear.  Other answers inline

 

On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>
wrote:

Sandy,

 

The last trick worked but now I have couple of more questions

 

1.      If I don't request for rack and relax locality is false with
scheduler delay on , I see that when I pass a wrong host I don't get any
container back. Why so?

When locality relaxation is turned on, we will only ever place the container
on the host that you requested.  This means that if no such host exists, we
will never place the container.  This behavior could maybe be improved, but
there are some tricky issues to deal with there about nodes going down and
such. 

2.      I also noticed that with scheduler delay on and relax locality set
to false, If I request for rack along with a host I get one container on
expected node but not other containers. 

3.      With scheduler delay on and relax locality set to true without
requesting rack, I don't get the containers on the required host

What scheduler are you using and what properties are you using to turn the
scheduler delay on? 

 

Thanks

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 11:41 AM
To: user@hadoop.apache.org


Subject: Re: Allocating Containers on a particular Node in Yarn

 

Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

 

The documentation states:

   * <li>If locality relaxation is disabled, then only within the same
request,  

   * a node and its rack may be specified together. This allows for a
specific   

   * rack with a preference for a specific node within that rack.</li>

 

 

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

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 <ga...@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 <ga...@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 <ga...@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
<http://www.cs.berkeley.edu/%7Ematei/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 <th...@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 <ga...@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

 

 

 

 

 

 

 

 

 

 


RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Sandy,

 

For the first question you mentioned relaxation locality is turn on, I
assume you mean that relax locality is set to false right?

 

For scheduler, I am using capacity scheduler and modified following property
in capacity-scheduler.xml

<property>

<name>yarn.scheduler.capacity.node-locality-delay</name>

     <value>1</value>

     <description>

       Number of missed scheduling opportunities after which the
CapacityScheduler

       attempts to schedule rack-local containers.

       Typically this should be set to number of racks in the cluster, this

       feature is disabled by default, set to -1.

     </description>

   </property>

 

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 12:41 PM
To: user@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

 

Great to hear.  Other answers inline

 

On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>
wrote:

Sandy,

 

The last trick worked but now I have couple of more questions

 

1.      If I don't request for rack and relax locality is false with
scheduler delay on , I see that when I pass a wrong host I don't get any
container back. Why so?

When locality relaxation is turned on, we will only ever place the container
on the host that you requested.  This means that if no such host exists, we
will never place the container.  This behavior could maybe be improved, but
there are some tricky issues to deal with there about nodes going down and
such. 

2.      I also noticed that with scheduler delay on and relax locality set
to false, If I request for rack along with a host I get one container on
expected node but not other containers. 

3.      With scheduler delay on and relax locality set to true without
requesting rack, I don't get the containers on the required host

What scheduler are you using and what properties are you using to turn the
scheduler delay on? 

 

Thanks

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 11:41 AM
To: user@hadoop.apache.org


Subject: Re: Allocating Containers on a particular Node in Yarn

 

Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

 

The documentation states:

   * <li>If locality relaxation is disabled, then only within the same
request,  

   * a node and its rack may be specified together. This allows for a
specific   

   * rack with a preference for a specific node within that rack.</li>

 

 

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

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 <ga...@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 <ga...@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 <ga...@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
<http://www.cs.berkeley.edu/%7Ematei/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 <th...@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 <ga...@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

 

 

 

 

 

 

 

 

 

 


Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Great to hear.  Other answers inline


On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>wrote:

> Sandy,
>
>
>
> The last trick worked but now I have couple of more questions
>
>
>
> 1.      If I don’t request for rack and relax locality is false with
> scheduler delay on , I see that when I pass a wrong host I don’t get any
> container back. Why so?
>
When locality relaxation is turned on, we will only ever place the
container on the host that you requested.  This means that if no such host
exists, we will never place the container.  This behavior could maybe be
improved, but there are some tricky issues to deal with there about nodes
going down and such.

> 2.      I also noticed that with scheduler delay on and relax locality
> set to false, If I request for rack along with a host I get one container
> on expected node but not other containers.
>
> 3.      With scheduler delay on and relax locality set to true without
> requesting rack, I don’t get the containers on the required host
>
What scheduler are you using and what properties are you using to turn the
scheduler delay on?

>
>
> Thanks
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 11:41 AM
> *To:* user@hadoop.apache.org
>
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Requesting the rack is not necessary, and is leading to the behavior that
> you're seeing.
>
>
>
> The documentation states:
>
>    * <li>If locality relaxation is disabled, then only within the same
> request,
>
>    * a node and its rack may be specified together. This allows for a
> specific
>
>    * rack with a preference for a specific node within that rack.</li>
>
>
>
>
>
> On Wed, Nov 13, 2013 at 10:10 PM, gaurav <ga...@datatorrent.com> wrote:
>
> 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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Great to hear.  Other answers inline


On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>wrote:

> Sandy,
>
>
>
> The last trick worked but now I have couple of more questions
>
>
>
> 1.      If I don’t request for rack and relax locality is false with
> scheduler delay on , I see that when I pass a wrong host I don’t get any
> container back. Why so?
>
When locality relaxation is turned on, we will only ever place the
container on the host that you requested.  This means that if no such host
exists, we will never place the container.  This behavior could maybe be
improved, but there are some tricky issues to deal with there about nodes
going down and such.

> 2.      I also noticed that with scheduler delay on and relax locality
> set to false, If I request for rack along with a host I get one container
> on expected node but not other containers.
>
> 3.      With scheduler delay on and relax locality set to true without
> requesting rack, I don’t get the containers on the required host
>
What scheduler are you using and what properties are you using to turn the
scheduler delay on?

>
>
> Thanks
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 11:41 AM
> *To:* user@hadoop.apache.org
>
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Requesting the rack is not necessary, and is leading to the behavior that
> you're seeing.
>
>
>
> The documentation states:
>
>    * <li>If locality relaxation is disabled, then only within the same
> request,
>
>    * a node and its rack may be specified together. This allows for a
> specific
>
>    * rack with a preference for a specific node within that rack.</li>
>
>
>
>
>
> On Wed, Nov 13, 2013 at 10:10 PM, gaurav <ga...@datatorrent.com> wrote:
>
> 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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Great to hear.  Other answers inline


On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>wrote:

> Sandy,
>
>
>
> The last trick worked but now I have couple of more questions
>
>
>
> 1.      If I don’t request for rack and relax locality is false with
> scheduler delay on , I see that when I pass a wrong host I don’t get any
> container back. Why so?
>
When locality relaxation is turned on, we will only ever place the
container on the host that you requested.  This means that if no such host
exists, we will never place the container.  This behavior could maybe be
improved, but there are some tricky issues to deal with there about nodes
going down and such.

> 2.      I also noticed that with scheduler delay on and relax locality
> set to false, If I request for rack along with a host I get one container
> on expected node but not other containers.
>
> 3.      With scheduler delay on and relax locality set to true without
> requesting rack, I don’t get the containers on the required host
>
What scheduler are you using and what properties are you using to turn the
scheduler delay on?

>
>
> Thanks
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 11:41 AM
> *To:* user@hadoop.apache.org
>
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Requesting the rack is not necessary, and is leading to the behavior that
> you're seeing.
>
>
>
> The documentation states:
>
>    * <li>If locality relaxation is disabled, then only within the same
> request,
>
>    * a node and its rack may be specified together. This allows for a
> specific
>
>    * rack with a preference for a specific node within that rack.</li>
>
>
>
>
>
> On Wed, Nov 13, 2013 at 10:10 PM, gaurav <ga...@datatorrent.com> wrote:
>
> 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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Great to hear.  Other answers inline


On Thu, Nov 14, 2013 at 12:05 PM, Gaurav Gupta <ga...@datatorrent.com>wrote:

> Sandy,
>
>
>
> The last trick worked but now I have couple of more questions
>
>
>
> 1.      If I don’t request for rack and relax locality is false with
> scheduler delay on , I see that when I pass a wrong host I don’t get any
> container back. Why so?
>
When locality relaxation is turned on, we will only ever place the
container on the host that you requested.  This means that if no such host
exists, we will never place the container.  This behavior could maybe be
improved, but there are some tricky issues to deal with there about nodes
going down and such.

> 2.      I also noticed that with scheduler delay on and relax locality
> set to false, If I request for rack along with a host I get one container
> on expected node but not other containers.
>
> 3.      With scheduler delay on and relax locality set to true without
> requesting rack, I don’t get the containers on the required host
>
What scheduler are you using and what properties are you using to turn the
scheduler delay on?

>
>
> Thanks
>
> -Gaurav
>
>
>
> *From:* Sandy Ryza [mailto:sandy.ryza@cloudera.com]
> *Sent:* Thursday, November 14, 2013 11:41 AM
> *To:* user@hadoop.apache.org
>
> *Subject:* Re: Allocating Containers on a particular Node in Yarn
>
>
>
> Requesting the rack is not necessary, and is leading to the behavior that
> you're seeing.
>
>
>
> The documentation states:
>
>    * <li>If locality relaxation is disabled, then only within the same
> request,
>
>    * a node and its rack may be specified together. This allows for a
> specific
>
>    * rack with a preference for a specific node within that rack.</li>
>
>
>
>
>
> On Wed, Nov 13, 2013 at 10:10 PM, gaurav <ga...@datatorrent.com> wrote:
>
> 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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Sandy,

 

The last trick worked but now I have couple of more questions

 

1.      If I don't request for rack and relax locality is false with
scheduler delay on , I see that when I pass a wrong host I don't get any
container back. Why so?

2.      I also noticed that with scheduler delay on and relax locality set
to false, If I request for rack along with a host I get one container on
expected node but not other containers. 

3.      With scheduler delay on and relax locality set to true without
requesting rack, I don't get the containers on the required host

 

Thanks

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 11:41 AM
To: user@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

 

Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

 

The documentation states:

   * <li>If locality relaxation is disabled, then only within the same
request,  

   * a node and its rack may be specified together. This allows for a
specific   

   * rack with a preference for a specific node within that rack.</li>

 

 

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

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 <ga...@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 <ga...@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 <ga...@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
<http://www.cs.berkeley.edu/%7Ematei/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 <th...@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 <ga...@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

 

 

 

 

 

 

 

 

 


RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Sandy,

 

The last trick worked but now I have couple of more questions

 

1.      If I don't request for rack and relax locality is false with
scheduler delay on , I see that when I pass a wrong host I don't get any
container back. Why so?

2.      I also noticed that with scheduler delay on and relax locality set
to false, If I request for rack along with a host I get one container on
expected node but not other containers. 

3.      With scheduler delay on and relax locality set to true without
requesting rack, I don't get the containers on the required host

 

Thanks

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 11:41 AM
To: user@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

 

Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

 

The documentation states:

   * <li>If locality relaxation is disabled, then only within the same
request,  

   * a node and its rack may be specified together. This allows for a
specific   

   * rack with a preference for a specific node within that rack.</li>

 

 

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

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 <ga...@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 <ga...@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 <ga...@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
<http://www.cs.berkeley.edu/%7Ematei/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 <th...@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 <ga...@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

 

 

 

 

 

 

 

 

 


RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Sandy,

 

The last trick worked but now I have couple of more questions

 

1.      If I don't request for rack and relax locality is false with
scheduler delay on , I see that when I pass a wrong host I don't get any
container back. Why so?

2.      I also noticed that with scheduler delay on and relax locality set
to false, If I request for rack along with a host I get one container on
expected node but not other containers. 

3.      With scheduler delay on and relax locality set to true without
requesting rack, I don't get the containers on the required host

 

Thanks

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 11:41 AM
To: user@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

 

Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

 

The documentation states:

   * <li>If locality relaxation is disabled, then only within the same
request,  

   * a node and its rack may be specified together. This allows for a
specific   

   * rack with a preference for a specific node within that rack.</li>

 

 

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

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 <ga...@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 <ga...@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 <ga...@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
<http://www.cs.berkeley.edu/%7Ematei/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 <th...@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 <ga...@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

 

 

 

 

 

 

 

 

 


RE: Allocating Containers on a particular Node in Yarn

Posted by Gaurav Gupta <ga...@datatorrent.com>.
Sandy,

 

The last trick worked but now I have couple of more questions

 

1.      If I don't request for rack and relax locality is false with
scheduler delay on , I see that when I pass a wrong host I don't get any
container back. Why so?

2.      I also noticed that with scheduler delay on and relax locality set
to false, If I request for rack along with a host I get one container on
expected node but not other containers. 

3.      With scheduler delay on and relax locality set to true without
requesting rack, I don't get the containers on the required host

 

Thanks

-Gaurav

 

From: Sandy Ryza [mailto:sandy.ryza@cloudera.com] 
Sent: Thursday, November 14, 2013 11:41 AM
To: user@hadoop.apache.org
Subject: Re: Allocating Containers on a particular Node in Yarn

 

Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

 

The documentation states:

   * <li>If locality relaxation is disabled, then only within the same
request,  

   * a node and its rack may be specified together. This allows for a
specific   

   * rack with a preference for a specific node within that rack.</li>

 

 

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

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 <ga...@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 <ga...@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 <ga...@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
<http://www.cs.berkeley.edu/%7Ematei/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 <th...@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 <ga...@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

 

 

 

 

 

 

 

 

 


Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

The documentation states:
   * <li>If locality relaxation is disabled, then only within the same
request,
   * a node and its rack may be specified together. This allows for a
specific
   * rack with a preference for a specific node within that rack.</li>



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

>  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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>>>>>>>
>>>>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

The documentation states:
   * <li>If locality relaxation is disabled, then only within the same
request,
   * a node and its rack may be specified together. This allows for a
specific
   * rack with a preference for a specific node within that rack.</li>



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

>  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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>>>>>>>
>>>>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

The documentation states:
   * <li>If locality relaxation is disabled, then only within the same
request,
   * a node and its rack may be specified together. This allows for a
specific
   * rack with a preference for a specific node within that rack.</li>



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

>  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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>>>>>>>
>>>>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
Requesting the rack is not necessary, and is leading to the behavior that
you're seeing.

The documentation states:
   * <li>If locality relaxation is disabled, then only within the same
request,
   * a node and its rack may be specified together. This allows for a
specific
   * rack with a preference for a specific node within that rack.</li>



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

>  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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>>>>>>>
>>>>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>>>     <ma...@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 <ma...@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
>>>>                 <http://www.cs.berkeley.edu/%7Ematei/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
>>>>                 <ma...@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
>>>>                     <ma...@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
>>>>                         <ma...@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
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>>>     <ma...@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 <ma...@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
>>>>                 <http://www.cs.berkeley.edu/%7Ematei/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
>>>>                 <ma...@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
>>>>                     <ma...@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
>>>>                         <ma...@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
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>>>     <ma...@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 <ma...@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
>>>>                 <http://www.cs.berkeley.edu/%7Ematei/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
>>>>                 <ma...@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
>>>>                     <ma...@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
>>>>                         <ma...@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
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>>>     <ma...@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 <ma...@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
>>>>                 <http://www.cs.berkeley.edu/%7Ematei/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
>>>>                 <ma...@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
>>>>                     <ma...@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
>>>>                         <ma...@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
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>>>>>>
>>>>>>
>>>
>>
>>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>>>>>>
>>>>>>
>>>
>>
>>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>>>>>>
>>>>>>
>>>
>>
>>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <ga...@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 <ga...@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 <ga...@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 <ga...@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
>>>>>>
>>>>>>
>>>
>>
>>
>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
>> <ma...@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
>>>     <ma...@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
>>>             <http://www.cs.berkeley.edu/%7Ematei/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
>>>             <ma...@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 <ma...@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
>>>                     <ma...@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
>>>
>>>
>>>
>>
>>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
>> <ma...@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
>>>     <ma...@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
>>>             <http://www.cs.berkeley.edu/%7Ematei/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
>>>             <ma...@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 <ma...@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
>>>                     <ma...@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
>>>
>>>
>>>
>>
>>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
>> <ma...@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
>>>     <ma...@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
>>>             <http://www.cs.berkeley.edu/%7Ematei/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
>>>             <ma...@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 <ma...@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
>>>                     <ma...@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
>>>
>>>
>>>
>>
>>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
>> <ma...@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
>>>     <ma...@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
>>>             <http://www.cs.berkeley.edu/%7Ematei/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
>>>             <ma...@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 <ma...@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
>>>                     <ma...@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
>>>
>>>
>>>
>>
>>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>>     <ma...@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
>>             <http://www.cs.berkeley.edu/%7Ematei/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
>>             <ma...@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 <ma...@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
>>                     <ma...@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
>>
>>
>>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>>     <ma...@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
>>             <http://www.cs.berkeley.edu/%7Ematei/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
>>             <ma...@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 <ma...@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
>>                     <ma...@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
>>
>>
>>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>>     <ma...@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
>>             <http://www.cs.berkeley.edu/%7Ematei/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
>>             <ma...@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 <ma...@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
>>                     <ma...@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
>>
>>
>>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>>     <ma...@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
>>             <http://www.cs.berkeley.edu/%7Ematei/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
>>             <ma...@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 <ma...@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
>>                     <ma...@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
>>
>>
>>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <ga...@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 <ga...@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 <ga...@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
>>>>>
>>>>>
>>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <ga...@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 <ga...@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 <ga...@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
>>>>>
>>>>>
>>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <ga...@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 <ga...@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 <ga...@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
>>>>>
>>>>>
>>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <ga...@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 <ga...@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 <ga...@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
>>>>>
>>>>>
>>
>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>         <http://www.cs.berkeley.edu/%7Ematei/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 <ma...@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 <ma...@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
>                 <ma...@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
>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>         <http://www.cs.berkeley.edu/%7Ematei/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 <ma...@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 <ma...@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
>                 <ma...@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
>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>         <http://www.cs.berkeley.edu/%7Ematei/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 <ma...@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 <ma...@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
>                 <ma...@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
>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 
> <ma...@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
>         <http://www.cs.berkeley.edu/%7Ematei/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 <ma...@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 <ma...@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
>                 <ma...@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
>
>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
[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 <ga...@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 <ga...@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
>>>>
>>>>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
[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 <ga...@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 <ga...@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
>>>>
>>>>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
[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 <ga...@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 <ga...@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
>>>>
>>>>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
[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 <ga...@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 <ga...@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
>>>>
>>>>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
[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 <ga...@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 <ga...@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
>>>>
>>>>
>

Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
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 <th...@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 <ga...@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
>>>


Re: Allocating Containers on a particular Node in Yarn

Posted by Sandy Ryza <sa...@cloudera.com>.
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 <th...@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 <ga...@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
> >
>

Re: Allocating Containers on a particular Node in Yarn

Posted by Thomas Weise <th...@gmail.com>.
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 <tu...@cloudera.com>wrote:

> Gaurav,
>
> Setting relaxLocality to FALSE should do it.
>
> thanks.
>
>
> On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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
>

Re: Allocating Containers on a particular Node in Yarn

Posted by gaurav <ga...@datatorrent.com>.
Hi,

I had set the locality to false and request becomes as follows

/ {Priority: 0, Capability: <memory:8192, vCores:0>, # Containers: 1, 
Location: *, Relax Locality: false}, {Priority: 0, Capability: 
<memory:8192, vCores:0>, # Containers: 1, Location: /default-rack, Relax 
Locality: true}, {Priority: 0, Capability: <memory:8192, vCores:0>, # 
Containers: 1, Location: h1 Relax Locality: true}//
/
I checked AMRMClientImpl class and it is not respecting relaxlocality 
for node and racks (line 361 and368) resulting the above request.
Since one of ask has location set to h1, I expect container to be 
allocated on h1 but I get container on random hosts. I tweaked the code 
in AMRMClientImpl and made sure that relaxlocality is respected for node 
and rack, my new request becomes as following

/ {Priority: 0, Capability: <memory:8192, vCores:0>, # Containers: 1, 
Location: *, Relax Locality: false}, {Priority: 0, Capability: 
<memory:8192, vCores:0>, # Containers: 1, Location: /default-rack, Relax 
Locality: false}, {Priority: 0, Capability: <memory:8192, vCores:0>, # 
Containers: 1, Location: h1 Relax Locality: false}//
/
Now I get container on correct node h1. Not sure how will the fail over 
work in this case.

Thanks
-Gaurav

On 11/13/2013 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 <ga...@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
>>
>>
>>
>>
>>
>


Re: Allocating Containers on a particular Node in Yarn

Posted by Alejandro Abdelnur <tu...@cloudera.com>.
Gaurav,

Setting relaxLocality to FALSE should do it.

thanks.


On Wed, Nov 13, 2013 at 2:58 PM, gaurav <ga...@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