org.apache.hadoop.yarn.client.api
Class AMRMClient.ContainerRequest
java.lang.Object
org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest
- Enclosing class:
- AMRMClient<T extends AMRMClient.ContainerRequest>
public static class AMRMClient.ContainerRequest
- extends Object
Object to represent a single container request for resources. Scheduler
documentation should be consulted for the specifics of how the parameters
are honored.
By default, YARN schedulers try to allocate containers at the requested
locations but they may relax the constraints in order to expedite meeting
allocations limits. They first relax the constraint to the same rack as the
requested node and then to anywhere in the cluster. The relaxLocality flag
may be used to disable locality relaxation and request containers at only
specific locations. The following conditions apply.
- Within a priority, all container requests must have the same value for
locality relaxation. Either enabled or disabled.
- If locality relaxation is disabled, then across requests, locations at
different network levels may not be specified. E.g. its invalid to make a
request for a specific node and another request for a specific rack.
- 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.
To re-enable locality relaxation at a given priority, all pending requests
with locality relaxation disabled must be first removed. Then they can be
added back with locality relaxation enabled.
All getters return immutable values.
AMRMClient.ContainerRequest
public AMRMClient.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
String[] nodes,
String[] racks,
org.apache.hadoop.yarn.api.records.Priority priority)
- Instantiates a
AMRMClient.ContainerRequest
with the given constraints and
locality relaxation enabled.
- Parameters:
capability
- The Resource
to be requested for each container.nodes
- Any hosts to request that the containers are placed on.racks
- Any racks to request that the containers are placed on. The
racks corresponding to any hosts requested will be automatically
added to this list.priority
- The priority at which to request the containers. Higher
priorities have lower numerical values.
AMRMClient.ContainerRequest
public AMRMClient.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
String[] nodes,
String[] racks,
org.apache.hadoop.yarn.api.records.Priority priority,
boolean relaxLocality)
- Instantiates a
AMRMClient.ContainerRequest
with the given constraints.
- Parameters:
capability
- The Resource
to be requested for each container.nodes
- Any hosts to request that the containers are placed on.racks
- Any racks to request that the containers are placed on. The
racks corresponding to any hosts requested will be automatically
added to this list.priority
- The priority at which to request the containers. Higher
priorities have lower numerical values.relaxLocality
- If true, containers for this request may be assigned on hosts
and racks other than the ones explicitly requested.
getCapability
public org.apache.hadoop.yarn.api.records.Resource getCapability()
getNodes
public List<String> getNodes()
getRacks
public List<String> getRacks()
getPriority
public org.apache.hadoop.yarn.api.records.Priority getPriority()
getRelaxLocality
public boolean getRelaxLocality()
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2014 Apache Software Foundation. All Rights Reserved.