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

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

# Class ResourceUtilization

java.lang.Object
org.apache.hadoop.yarn.api.records.ResourceUtilization

All Implemented Interfaces:
  `Comparable<ResourceUtilization>`

@Public @Unstable public abstract class ResourceUtilization extends Object implements Comparable<ResourceUtilization>

`ResourceUtilization` models the utilization of a set of computer resources in the cluster.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResourceUtilization()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addTo(int pmem, int vmem, float cpu)`
  Add utilization to the current one.
  `void`
  `addTo(int pmem, int vmem, float cpu, String resourceName, float utilization)`
  Add utilization to the current one.
  `boolean`
  `equals(Object obj)`
  `abstract float`
  `getCPU()`
  Get CPU utilization (The amount of vcores used).
  `float`
  `getCustomResource(String resourceName)`
  Get custom resource utilization (The amount of custom resource used).
  `Map<String,Float>`
  `getCustomResources()`
  `abstract int`
  `getPhysicalMemory()`
  Get physical memory.
  `abstract int`
  `getVirtualMemory()`
  Get used virtual memory.
  `int`
  `hashCode()`
  `static ResourceUtilization`
  `newInstance(int pmem, int vmem, float cpu)`
  `static ResourceUtilization`
  `newInstance(int pmem, int vmem, float cpu, Map<String,Float> customResources)`
  `static ResourceUtilization`
  `newInstance(ResourceUtilization resourceUtil)`
  `abstract void`
  `setCPU(float cpu)`
  Set CPU utilization (The amount of vcores used).
  `void`
  `setCustomResource(String resourceName, float utilization)`
  Set custom resource utilization (The amount of custom resource used).
  `void`
  `setCustomResources(Map<String,Float> customResources)`
  `abstract void`
  `setPhysicalMemory(int pmem)`
  Set physical memory.
  `abstract void`
  `setVirtualMemory(int vmem)`
  Set used virtual memory.
  `void`
  `subtractFrom(int pmem, int vmem, float cpu)`
  Subtract utilization from the current one.
  `void`
  `subtractFrom(int pmem, int vmem, float cpu, String resourceName, float utilization)`
  Subtract utilization from the current one.
  `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 Details

  - ### ResourceUtilization

    public ResourceUtilization()

- ## Method Details

  - ### newInstance

    @Public @Unstable public static ResourceUtilization newInstance(int pmem, int vmem, float cpu)

  - ### newInstance

    @Public @Unstable public static ResourceUtilization newInstance(int pmem, int vmem, float cpu, Map<String,Float> customResources)

  - ### newInstance

    @Public @Unstable public static ResourceUtilization newInstance(ResourceUtilization resourceUtil)

  - ### getVirtualMemory

    @Public @Unstable public abstract int getVirtualMemory()
    Get used virtual memory.
    Returns:
      virtual memory in MB

  - ### setVirtualMemory

    @Public @Unstable public abstract void setVirtualMemory(int vmem)
    Set used virtual memory.
    Parameters:
      `vmem` - virtual memory in MB

  - ### getPhysicalMemory

    @Public @Unstable public abstract int getPhysicalMemory()
    Get physical memory.
    Returns:
      physical memory in MB

  - ### setPhysicalMemory

    @Public @Unstable public abstract void setPhysicalMemory(int pmem)
    Set physical memory.
    Parameters:
      `pmem` - physical memory in MB

  - ### getCPU

    @Public @Unstable public abstract float getCPU()
    Get CPU utilization (The amount of vcores used).
    Returns:
      CPU utilization

  - ### setCPU

    @Public @Unstable public abstract void setCPU(float cpu)
    Set CPU utilization (The amount of vcores used).
    Parameters:
      `cpu` - CPU utilization

  - ### getCustomResource

    @Public @Unstable public float getCustomResource(String resourceName)
    Get custom resource utilization (The amount of custom resource used).
    Parameters:
      `resourceName` - resourceName of custom resource
    Returns:
      resourceName utilization

  - ### getCustomResources

    @Public @Unstable public Map<String,Float> getCustomResources()

  - ### setCustomResources

    @Public @Unstable public void setCustomResources(Map<String,Float> customResources)

  - ### setCustomResource

    @Public @Unstable public void setCustomResource(String resourceName, float utilization)
    Set custom resource utilization (The amount of custom resource used).
    Parameters:
      `resourceName` - resourceName
      `utilization` - utilization of custom 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`

  - ### addTo

    @Public @Unstable public void addTo(int pmem, int vmem, float cpu)
    Add utilization to the current one.
    Parameters:
      `pmem` - Physical memory used to add.
      `vmem` - Virtual memory used to add.
      `cpu` - CPU utilization to add.

  - ### addTo

    @Public @Unstable public void addTo(int pmem, int vmem, float cpu, String resourceName, float utilization)
    Add utilization to the current one.
    Parameters:
      `pmem` - Physical memory used to add.
      `vmem` - Virtual memory used to add.
      `cpu` - CPU utilization to add.
      `resourceName` - of custom resource to add.
      `utilization` - of custom resource to add.

  - ### subtractFrom

    @Public @Unstable public void subtractFrom(int pmem, int vmem, float cpu)
    Subtract utilization from the current one.
    Parameters:
      `pmem` - Physical memory to be subtracted.
      `vmem` - Virtual memory to be subtracted.
      `cpu` - CPU utilization to be subtracted.

  - ### subtractFrom

    @Public @Unstable public void subtractFrom(int pmem, int vmem, float cpu, String resourceName, float utilization)
    Subtract utilization from the current one.
    Parameters:
      `pmem` - Physical memory to be subtracted.
      `vmem` - Virtual memory to be subtracted.
      `cpu` - CPU utilization to be subtracted.
      `resourceName` - of custom resource to be subtracted.
      `utilization` - of custom resource to be subtracted.