Class AllocationBasedResourceUtilizationTracker

java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.scheduler.AllocationBasedResourceUtilizationTracker
All Implemented Interfaces:
ResourceUtilizationTracker

public class AllocationBasedResourceUtilizationTracker extends Object implements ResourceUtilizationTracker
An implementation of the ResourceUtilizationTracker that equates resource utilization with the total resource allocated to the container.
  • Method Details

    • getCurrentUtilization

      public org.apache.hadoop.yarn.api.records.ResourceUtilization getCurrentUtilization()
      Get the accumulation of totally allocated resources to a container.
      Specified by:
      getCurrentUtilization in interface ResourceUtilizationTracker
      Returns:
      ResourceUtilization Resource Utilization.
    • addContainerResources

      public void addContainerResources(Container container)
      Add Container's resources to the accumulated Utilization.
      Specified by:
      addContainerResources in interface ResourceUtilizationTracker
      Parameters:
      container - Container.
    • subtractContainerResource

      public void subtractContainerResource(Container container)
      Subtract Container's resources to the accumulated Utilization.
      Specified by:
      subtractContainerResource in interface ResourceUtilizationTracker
      Parameters:
      container - Container.
    • hasResourcesAvailable

      public boolean hasResourcesAvailable(Container container)
      Check if NM has resources available currently to run the container.
      Specified by:
      hasResourcesAvailable in interface ResourceUtilizationTracker
      Parameters:
      container - Container.
      Returns:
      True, if NM has resources available currently to run the container.
    • hasResourcesAvailable

      public boolean hasResourcesAvailable(org.apache.hadoop.yarn.api.records.Resource resource)
      Description copied from interface: ResourceUtilizationTracker
      Check if NM has resources available currently to run requested resources.
      Specified by:
      hasResourcesAvailable in interface ResourceUtilizationTracker
      Parameters:
      resource - the resources.
      Returns:
      True, if NM has enough available resources.
    • getContainersMonitor

      public ContainersMonitor getContainersMonitor()