@InterfaceAudience.Public @InterfaceStability.Stable public abstract class Resource extends Object implements Comparable<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.
Constructor and Description |
---|
Resource() |
Modifier and Type | Method and Description |
---|---|
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() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compareTo
public Resource()
@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 resourceCopyright © 2016 Apache Software Foundation. All rights reserved.