java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.service.Service, org.apache.hadoop.yarn.event.EventHandler<ContainersMonitorEvent>, ContainersMonitor, ResourceView

public class ContainersMonitorImpl extends org.apache.hadoop.service.AbstractService implements ContainersMonitor
Monitors containers collecting resource usage and preempting the container if it exceeds its limits.
  • Constructor Details

    • ContainersMonitorImpl

      public ContainersMonitorImpl(ContainerExecutor exec, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, Context context)
  • Method Details

    • serviceInit

      protected void serviceInit(org.apache.hadoop.conf.Configuration myConf) throws Exception
      Overrides:
      serviceInit in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • serviceStart

      protected void serviceStart() throws Exception
      Overrides:
      serviceStart in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • serviceStop

      protected void serviceStop() throws Exception
      Overrides:
      serviceStop in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • getVmemAllocatedForContainers

      public long getVmemAllocatedForContainers()
      Description copied from interface: ResourceView
      Get virtual memory allocated to the containers.
      Specified by:
      getVmemAllocatedForContainers in interface ResourceView
      Returns:
      Virtual memory in bytes.
    • isPmemCheckEnabled

      public boolean isPmemCheckEnabled()
      Is the total physical memory check enabled?
      Specified by:
      isPmemCheckEnabled in interface ResourceView
      Returns:
      true if total physical memory check is enabled.
    • getPmemAllocatedForContainers

      public long getPmemAllocatedForContainers()
      Description copied from interface: ResourceView
      Get physical memory allocated to the containers.
      Specified by:
      getPmemAllocatedForContainers in interface ResourceView
      Returns:
      Physical memory in bytes.
    • getVCoresAllocatedForContainers

      public long getVCoresAllocatedForContainers()
      Specified by:
      getVCoresAllocatedForContainers in interface ResourceView
    • setAllocatedResourcesForContainers

      public void setAllocatedResourcesForContainers(org.apache.hadoop.yarn.api.records.Resource resource)
      Description copied from interface: ContainersMonitor
      Set the allocated resources for containers.
      Specified by:
      setAllocatedResourcesForContainers in interface ContainersMonitor
      Parameters:
      resource - Resources allocated for the containers.
    • isVmemCheckEnabled

      public boolean isVmemCheckEnabled()
      Is the total virtual memory check enabled?
      Specified by:
      isVmemCheckEnabled in interface ResourceView
      Returns:
      true if total virtual memory check is enabled.
    • getContainersUtilization

      public org.apache.hadoop.yarn.api.records.ResourceUtilization getContainersUtilization()
      Specified by:
      getContainersUtilization in interface ContainersMonitor
    • subtractNodeResourcesFromResourceUtilization

      public void subtractNodeResourcesFromResourceUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization resourceUtil)
      Specified by:
      subtractNodeResourcesFromResourceUtilization in interface ContainersMonitor
    • getVmemRatio

      public float getVmemRatio()
      Specified by:
      getVmemRatio in interface ContainersMonitor
    • handle

      public void handle(ContainersMonitorEvent monitoringEvent)
      Specified by:
      handle in interface org.apache.hadoop.yarn.event.EventHandler<ContainersMonitorEvent>