Resource (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.yarn.service.api.records, class: Resource

Package org.apache.hadoop.yarn.service.api.records

# Class Resource

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:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Resource()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `calcMemoryMB()`
  `Object`
  `clone()`
  `Resource`
  `cpus(Integer cpus)`
  Amount of vcores allocated to each container (optional but overrides cpus in profile if specified).
  `boolean`
  `equals(Object o)`
  `Map<String,org.apache.hadoop.yarn.service.api.records.ResourceInformation>`
  `getAdditional()`
  Map of resource name to ResourceInformation
  `Integer`
  `getCpus()`
  `String`
  `getMemory()`
  `String`
  `getProfile()`
  `int`
  `hashCode()`
  `Resource`
  `memory(String memory)`
  Amount of memory allocated to each container (optional but overrides memory in profile if specified).
  `Resource`
  `profile(String profile)`
  Each resource profile has a unique id which is associated with a cluster-level predefined memory, cpus, etc.
  `Resource`
  `resourceInformations(Map<String,org.apache.hadoop.yarn.service.api.records.ResourceInformation> resourceInformations)`
  `void`
  `setCpus(Integer cpus)`
  `void`
  `setMemory(String memory)`
  `void`
  `setProfile(String profile)`
  `Resource`
  `setResourceInformations(Map<String,org.apache.hadoop.yarn.service.api.records.ResourceInformation> resourceInformations)`
  `String`
  `toString()`

  ### Methods inherited from class org.apache.hadoop.yarn.service.api.records.BaseResource

  `getUri, setUri`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## 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`