java.lang.Object
org.apache.hadoop.yarn.service.api.records.BaseResource
org.apache.hadoop.yarn.service.api.records.Resource
All Implemented Interfaces:
Serializable, Cloneable

@Public @Unstable public class Resource extends BaseResource implements Cloneable
Resource determines the amount of resources (vcores, memory, network, etc.) usable by a container. This field determines the resource to be applied for all the containers of a component or service. The resource specified at the service (or global) level can be overriden at the component level. Only one of profile OR cpu & memory are expected. It raises a validation exception otherwise.
See Also:
  • Constructor Details

    • Resource

      public Resource()
  • Method Details

    • profile

      public Resource profile(String profile)
      Each resource profile has a unique id which is associated with a cluster-level predefined memory, cpus, etc.
    • getProfile

      public String getProfile()
    • setProfile

      public void setProfile(String profile)
    • cpus

      public Resource cpus(Integer cpus)
      Amount of vcores allocated to each container (optional but overrides cpus in profile if specified).
    • getCpus

      public Integer getCpus()
    • setCpus

      public void setCpus(Integer cpus)
    • memory

      public Resource memory(String memory)
      Amount of memory allocated to each container (optional but overrides memory in profile if specified). Currently accepts only an integer value and default unit is in MB.
    • getMemory

      public String getMemory()
    • setMemory

      public void setMemory(String memory)
    • calcMemoryMB

      public long calcMemoryMB()
    • setResourceInformations

      public Resource setResourceInformations(Map<String,org.apache.hadoop.yarn.service.api.records.ResourceInformation> resourceInformations)
    • resourceInformations

      public Resource resourceInformations(Map<String,org.apache.hadoop.yarn.service.api.records.ResourceInformation> resourceInformations)
    • getAdditional

      public Map<String,org.apache.hadoop.yarn.service.api.records.ResourceInformation> getAdditional()
      Map of resource name to ResourceInformation
      Returns:
      additional
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class BaseResource
    • clone

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException