java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.numa.NumaNodeResource

public class NumaNodeResource extends Object
NumaNodeResource class holds the NUMA node topology with the total and used resources.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NumaNodeResource(String nodeId, long totalMemory, int totalCpus)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    assignAvailableCpus(int cpusreq, org.apache.hadoop.yarn.api.records.ContainerId containerId)
    Assigns available cpu's and returns the remaining needed cpu's.
    long
    assignAvailableMemory(long memreq, org.apache.hadoop.yarn.api.records.ContainerId containerId)
    Assigns available memory and returns the remaining needed memory.
    void
    assignResources(org.apache.hadoop.yarn.api.records.Resource resource, org.apache.hadoop.yarn.api.records.ContainerId containerId)
    Assigns the requested resources for Container.
    boolean
     
     
    int
     
    boolean
    isResourcesAvailable(org.apache.hadoop.yarn.api.records.Resource resource)
    Checks whether the specified resources available or not.
    void
    recoverCpus(org.apache.hadoop.yarn.api.records.ContainerId containerId, int cpus)
    Recovers the cpu's resources for Container.
    void
    recoverMemory(org.apache.hadoop.yarn.api.records.ContainerId containerId, long memory)
    Recovers the memory resources for Container.
    void
    releaseResources(org.apache.hadoop.yarn.api.records.ContainerId containerId)
    Releases the assigned resources for Container.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • NumaNodeResource

      public NumaNodeResource(String nodeId, long totalMemory, int totalCpus)
  • Method Details

    • isResourcesAvailable

      public boolean isResourcesAvailable(org.apache.hadoop.yarn.api.records.Resource resource)
      Checks whether the specified resources available or not.
      Parameters:
      resource - resource
      Returns:
      whether the specified resources available or not
    • assignAvailableMemory

      public long assignAvailableMemory(long memreq, org.apache.hadoop.yarn.api.records.ContainerId containerId)
      Assigns available memory and returns the remaining needed memory.
      Parameters:
      memreq - required memory
      containerId - which container memory to assign
      Returns:
      remaining needed memory
    • assignAvailableCpus

      public int assignAvailableCpus(int cpusreq, org.apache.hadoop.yarn.api.records.ContainerId containerId)
      Assigns available cpu's and returns the remaining needed cpu's.
      Parameters:
      cpusreq - required cpu's
      containerId - which container cpu's to assign
      Returns:
      remaining needed cpu's
    • assignResources

      public void assignResources(org.apache.hadoop.yarn.api.records.Resource resource, org.apache.hadoop.yarn.api.records.ContainerId containerId)
      Assigns the requested resources for Container.
      Parameters:
      resource - resource to assign
      containerId - to which container the resources to assign
    • releaseResources

      public void releaseResources(org.apache.hadoop.yarn.api.records.ContainerId containerId)
      Releases the assigned resources for Container.
      Parameters:
      containerId - to which container the assigned resources to release
    • recoverMemory

      public void recoverMemory(org.apache.hadoop.yarn.api.records.ContainerId containerId, long memory)
      Recovers the memory resources for Container.
      Parameters:
      containerId - recover the memory resources for the Container
      memory - memory to recover
    • recoverCpus

      public void recoverCpus(org.apache.hadoop.yarn.api.records.ContainerId containerId, int cpus)
      Recovers the cpu's resources for Container.
      Parameters:
      containerId - recover the cpu's resources for the Container
      cpus - cpu's to recover
    • toString

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

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

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

      public String getNodeId()