Class AMRMClient.ContainerRequest
java.lang.Object
org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest
- Enclosing class:
- AMRMClient<T extends AMRMClient.ContainerRequest>
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classClass to construct instances ofAMRMClient.ContainerRequestwith specific options. -
Constructor Summary
ConstructorsConstructorDescriptionContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority) Instantiates aAMRMClient.ContainerRequestwith the given constraints and locality relaxation enabled.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, boolean relaxLocality) Instantiates aAMRMClient.ContainerRequestwith the given constraints.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, boolean relaxLocality, String nodeLabelsExpression) Instantiates aAMRMClient.ContainerRequestwith the given constraints.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId) Instantiates aAMRMClient.ContainerRequestwith the given constraints and locality relaxation enabled.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality) Instantiates aAMRMClient.ContainerRequestwith the given constraints.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression) Instantiates aAMRMClient.ContainerRequestwith the given constraints.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression, org.apache.hadoop.yarn.api.records.ExecutionTypeRequest executionTypeRequest) Instantiates aAMRMClient.ContainerRequestwith the given constraints.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression, org.apache.hadoop.yarn.api.records.ExecutionTypeRequest executionTypeRequest, String profile) Instantiates aAMRMClient.ContainerRequestwith the given constraints.ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, String profile) -
Method Summary
-
Constructor Details
-
ContainerRequest
public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority) Instantiates aAMRMClient.ContainerRequestwith the given constraints and locality relaxation enabled.- Parameters:
capability- TheResourceto 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.
-
ContainerRequest
-
ContainerRequest
@Public @Evolving public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId) Instantiates aAMRMClient.ContainerRequestwith the given constraints and locality relaxation enabled.- Parameters:
capability- TheResourceto 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.allocationRequestId- Allocation Request Id
-
ContainerRequest
public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, boolean relaxLocality) Instantiates aAMRMClient.ContainerRequestwith the given constraints.- Parameters:
capability- TheResourceto 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.
-
ContainerRequest
@Public @Evolving public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality) Instantiates aAMRMClient.ContainerRequestwith the given constraints.- Parameters:
capability- TheResourceto 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.allocationRequestId- Allocation Request Id
-
ContainerRequest
public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, boolean relaxLocality, String nodeLabelsExpression) Instantiates aAMRMClient.ContainerRequestwith the given constraints.- Parameters:
capability- TheResourceto 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.nodeLabelsExpression- Set node labels to allocate resource, now we only support asking for only a single node label
-
ContainerRequest
@Public @Evolving public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression) Instantiates aAMRMClient.ContainerRequestwith the given constraints.- Parameters:
capability- TheResourceto 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.allocationRequestId- The allocationRequestId of the request. To be used as a tracking id to match Containers allocated against this request. Will default to 0 if not specified.relaxLocality- If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.nodeLabelsExpression- Set node labels to allocate resource, now we only support asking for only a single node label
-
ContainerRequest
public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression, org.apache.hadoop.yarn.api.records.ExecutionTypeRequest executionTypeRequest) Instantiates aAMRMClient.ContainerRequestwith the given constraints.- Parameters:
capability- TheResourceto 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.allocationRequestId- The allocationRequestId of the request. To be used as a tracking id to match Containers allocated against this request. Will default to 0 if not specified.relaxLocality- If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.nodeLabelsExpression- Set node labels to allocate resource, now we only support asking for only a single node labelexecutionTypeRequest- Set the execution type of the container request.
-
ContainerRequest
public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression, org.apache.hadoop.yarn.api.records.ExecutionTypeRequest executionTypeRequest, String profile) Instantiates aAMRMClient.ContainerRequestwith the given constraints.- Parameters:
capability- TheResourceto 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.allocationRequestId- The allocationRequestId of the request. To be used as a tracking id to match Containers allocated against this request. Will default to 0 if not specified.relaxLocality- If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.nodeLabelsExpression- Set node labels to allocate resource, now we only support asking for only a single node labelexecutionTypeRequest- Set the execution type of the container request.profile- Set the resource profile for the container request
-
-
Method Details
-
getCapability
public org.apache.hadoop.yarn.api.records.Resource getCapability() -
getNodes
-
getRacks
-
getPriority
public org.apache.hadoop.yarn.api.records.Priority getPriority() -
getAllocationRequestId
public long getAllocationRequestId() -
getRelaxLocality
public boolean getRelaxLocality() -
getNodeLabelExpression
-
getExecutionTypeRequest
public org.apache.hadoop.yarn.api.records.ExecutionTypeRequest getExecutionTypeRequest() -
getResourceProfile
-
toString
-
newBuilder
-