|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.yarn.api.records.Resource
@InterfaceAudience.Public @InterfaceStability.Stable public abstract class Resource
Resource
models a set of computer resources in the
cluster.
Currently it models both memory and CPU.
The unit for memory is megabytes. CPU is modeled with virtual cores (vcores), a unit for expressing parallelism. A node's capacity should be configured with virtual cores equal to its number of physical cores. A container should be requested with the number of cores it can saturate, i.e. the average number of threads it expects to have runnable at a time.
Virtual cores take integer values and thus currently CPU-scheduling is very coarse. A complementary axis for CPU requests that represents processing power will likely be added in the future to enable finer-grained resource configuration.
Typically, applications request Resource
of suitable
capability to run their component tasks.
ResourceRequest
,
ApplicationMasterProtocol.allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
Constructor Summary | |
---|---|
Resource()
|
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
abstract int |
getMemory()
Get memory of the resource. |
abstract int |
getVirtualCores()
Get number of virtual cpu cores of the resource. |
int |
hashCode()
|
static Resource |
newInstance(int memory,
int vCores)
|
abstract void |
setMemory(int memory)
Set memory of the resource. |
abstract void |
setVirtualCores(int vCores)
Set number of virtual cpu cores of the resource. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Constructor Detail |
---|
public Resource()
Method Detail |
---|
@InterfaceAudience.Public @InterfaceStability.Stable public static Resource newInstance(int memory, int vCores)
@InterfaceAudience.Public @InterfaceStability.Stable public abstract int getMemory()
@InterfaceAudience.Public @InterfaceStability.Stable public abstract void setMemory(int memory)
memory
- memory of the resource@InterfaceAudience.Public @InterfaceStability.Evolving public abstract int getVirtualCores()
@InterfaceAudience.Public @InterfaceStability.Evolving public abstract void setVirtualCores(int vCores)
vCores
- number of virtual cpu cores of the resourcepublic int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |