org.apache.hadoop.yarn.api.records
Class Resource

java.lang.Object
  extended by org.apache.hadoop.yarn.api.records.Resource
All Implemented Interfaces:
Comparable<Resource>

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class Resource
extends Object
implements Comparable<Resource>

Resource models a set of computer resources in the cluster.

Currrently it only models memory.

Typically, applications request Resource of suitable capability to run their component tasks.

See Also:
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

Resource

public Resource()
Method Detail

newInstance

@InterfaceAudience.Public
@InterfaceStability.Stable
public static Resource newInstance(int memory,
                                                                                      int vCores)

getMemory

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract int getMemory()
Get memory of the resource.

Returns:
memory of the resource

setMemory

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setMemory(int memory)
Set memory of the resource.

Parameters:
memory - memory of the resource

getVirtualCores

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract int getVirtualCores()
Get number of virtual cpu cores of the resource. We refer to virtual cores to clarify that these represent normalized cores which may have a m:n relationship w.r.t physical cores available on the compute nodes. Furthermore, they also represent idealized cores since the cluster might be composed of heterogenous nodes.

Returns:
num of virtual cpu cores of the resource

setVirtualCores

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract void setVirtualCores(int vCores)
Set number of virtual cpu cores of the resource. We refer to virtual cores to clarify that these represent normalized cores which may have a m:n relationship w.r.t physical cores available on the compute nodes. Furthermore, they also represent idealized cores since the cluster might be composed of heterogenous nodes.

Parameters:
vCores - number of virtual cpu cores of the resource

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Apache Software Foundation. All Rights Reserved.