@InterfaceAudience.Public @InterfaceStability.Stable public abstract class ResourceRequest extends Object implements Comparable<ResourceRequest>
ResourceRequest
represents the request made
by an application to the ResourceManager
to obtain various Container
allocations.
It includes:
Priority
of the request.Resource
required for each request.true
,
which tells the ResourceManager
if the application wants
locality to be loose (i.e. allows fall-through to rack or any)
or strict (i.e. specify hard constraint on resource allocation).
Modifier and Type | Class and Description |
---|---|
static class |
ResourceRequest.ResourceRequestComparator |
Modifier and Type | Field and Description |
---|---|
static String |
ANY
The constant string representing no locality.
|
Constructor and Description |
---|
ResourceRequest() |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ResourceRequest other) |
boolean |
equals(Object obj) |
abstract Resource |
getCapability()
Get the
Resource capability of the request. |
abstract String |
getNodeLabelExpression()
Get node-label-expression for this Resource Request.
|
abstract int |
getNumContainers()
Get the number of containers required with the given specifications.
|
abstract Priority |
getPriority()
Get the
Priority of the request. |
abstract boolean |
getRelaxLocality()
Get whether locality relaxation is enabled with this
ResourceRequest . |
abstract String |
getResourceName()
Get the resource (e.g.
|
int |
hashCode() |
static boolean |
isAnyLocation(String hostName)
Check whether the given host/rack string represents an arbitrary
host name.
|
static ResourceRequest |
newInstance(Priority priority,
String hostName,
Resource capability,
int numContainers) |
static ResourceRequest |
newInstance(Priority priority,
String hostName,
Resource capability,
int numContainers,
boolean relaxLocality) |
static ResourceRequest |
newInstance(Priority priority,
String hostName,
Resource capability,
int numContainers,
boolean relaxLocality,
String labelExpression) |
abstract void |
setCapability(Resource capability)
Set the
Resource capability of the request |
abstract void |
setNodeLabelExpression(String nodelabelExpression)
Set node label expression of this resource request.
|
abstract void |
setNumContainers(int numContainers)
Set the number of containers required with the given specifications
|
abstract void |
setPriority(Priority priority)
Set the
Priority of the request |
abstract void |
setRelaxLocality(boolean relaxLocality)
For a request at a network hierarchy level, set whether locality can be relaxed
to that level and beyond.
|
abstract void |
setResourceName(String resourceName)
Set the resource name (e.g.
|
public static final String ANY
public ResourceRequest()
@InterfaceAudience.Public @InterfaceStability.Stable public static ResourceRequest newInstance(Priority priority, String hostName, Resource capability, int numContainers)
@InterfaceAudience.Public @InterfaceStability.Stable public static ResourceRequest newInstance(Priority priority, String hostName, Resource capability, int numContainers, boolean relaxLocality)
@InterfaceAudience.Public @InterfaceStability.Stable public static ResourceRequest newInstance(Priority priority, String hostName, Resource capability, int numContainers, boolean relaxLocality, String labelExpression)
@InterfaceAudience.Public @InterfaceStability.Stable public static boolean isAnyLocation(String hostName)
hostName
- host/rack on which the allocation is desired@InterfaceAudience.Public @InterfaceStability.Stable public abstract Priority getPriority()
Priority
of the request.Priority
of the request@InterfaceAudience.Public @InterfaceStability.Stable public abstract void setPriority(Priority priority)
Priority
of the requestpriority
- Priority
of the request@InterfaceAudience.Public @InterfaceStability.Stable public abstract String getResourceName()
@InterfaceAudience.Public @InterfaceStability.Stable public abstract void setResourceName(String resourceName)
resourceName
- (e.g. host/rack) on which the
allocation is desired@InterfaceAudience.Public @InterfaceStability.Stable public abstract Resource getCapability()
Resource
capability of the request.Resource
capability of the request@InterfaceAudience.Public @InterfaceStability.Stable public abstract void setCapability(Resource capability)
Resource
capability of the requestcapability
- Resource
capability of the request@InterfaceAudience.Public @InterfaceStability.Stable public abstract int getNumContainers()
@InterfaceAudience.Public @InterfaceStability.Stable public abstract void setNumContainers(int numContainers)
numContainers
- number of containers required with the given
specifications@InterfaceAudience.Public @InterfaceStability.Stable public abstract boolean getRelaxLocality()
ResourceRequest
. Defaults to true.ResourceRequest
.@InterfaceAudience.Public @InterfaceStability.Stable public abstract void setRelaxLocality(boolean relaxLocality)
For a request at a network hierarchy level, set whether locality can be relaxed to that level and beyond.
If the flag is off on a rack-level ResourceRequest
,
containers at that request's priority will not be assigned to nodes on that
request's rack unless requests specifically for those nodes have also been
submitted.
If the flag is off on an ANY
-level
ResourceRequest
, containers at that request's priority will
only be assigned on racks for which specific requests have also been
submitted.
For example, to request a container strictly on a specific node, the corresponding rack-level and any-level requests should have locality relaxation set to false. Similarly, to request a container strictly on a specific rack, the corresponding any-level request should have locality relaxation set to false.
relaxLocality
- whether locality relaxation is enabled with this
ResourceRequest
.@InterfaceAudience.Public @InterfaceStability.Evolving public abstract String getNodeLabelExpression()
@InterfaceAudience.Public @InterfaceStability.Evolving public abstract void setNodeLabelExpression(String nodelabelExpression)
AND(&&), OR(||)
, etc.
Any please note that node label expression now can only take effect when
the resource request has resourceName = ANYnodelabelExpression
- node-label-expression of this ResourceRequestpublic int compareTo(ResourceRequest other)
compareTo
in interface Comparable<ResourceRequest>
Copyright © 2015 Apache Software Foundation. All rights reserved.