Class ContainersMonitorImpl
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumType of container metric.static classEncapsulates resource requirements of a process and its tree.Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
ConstructorsConstructorDescriptionContainersMonitorImpl(ContainerExecutor exec, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, Context context) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.yarn.api.records.ResourceUtilizationlongGet physical memory allocated to the containers.longlongGet virtual memory allocated to the containers.floatvoidhandle(ContainersMonitorEvent monitoringEvent) booleanIs the total physical memory check enabled?booleanIs the total virtual memory check enabled?protected voidserviceInit(org.apache.hadoop.conf.Configuration myConf) protected voidprotected voidvoidsetAllocatedResourcesForContainers(org.apache.hadoop.yarn.api.records.Resource resource) Set the allocated resources for containers.voidsubtractNodeResourcesFromResourceUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization resourceUtil) Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.service.Service
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, registerServiceListener, start, stop, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
ContainersMonitorImpl
public ContainersMonitorImpl(ContainerExecutor exec, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, Context context)
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
getVmemAllocatedForContainers
public long getVmemAllocatedForContainers()Description copied from interface:ResourceViewGet virtual memory allocated to the containers.- Specified by:
getVmemAllocatedForContainersin interfaceResourceView- Returns:
- Virtual memory in bytes.
-
isPmemCheckEnabled
public boolean isPmemCheckEnabled()Is the total physical memory check enabled?- Specified by:
isPmemCheckEnabledin interfaceResourceView- Returns:
- true if total physical memory check is enabled.
-
getPmemAllocatedForContainers
public long getPmemAllocatedForContainers()Description copied from interface:ResourceViewGet physical memory allocated to the containers.- Specified by:
getPmemAllocatedForContainersin interfaceResourceView- Returns:
- Physical memory in bytes.
-
getVCoresAllocatedForContainers
public long getVCoresAllocatedForContainers()- Specified by:
getVCoresAllocatedForContainersin interfaceResourceView
-
setAllocatedResourcesForContainers
public void setAllocatedResourcesForContainers(org.apache.hadoop.yarn.api.records.Resource resource) Description copied from interface:ContainersMonitorSet the allocated resources for containers.- Specified by:
setAllocatedResourcesForContainersin interfaceContainersMonitor- Parameters:
resource- Resources allocated for the containers.
-
isVmemCheckEnabled
public boolean isVmemCheckEnabled()Is the total virtual memory check enabled?- Specified by:
isVmemCheckEnabledin interfaceResourceView- Returns:
- true if total virtual memory check is enabled.
-
getContainersUtilization
public org.apache.hadoop.yarn.api.records.ResourceUtilization getContainersUtilization()- Specified by:
getContainersUtilizationin interfaceContainersMonitor
-
subtractNodeResourcesFromResourceUtilization
public void subtractNodeResourcesFromResourceUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization resourceUtil) - Specified by:
subtractNodeResourcesFromResourceUtilizationin interfaceContainersMonitor
-
getVmemRatio
public float getVmemRatio()- Specified by:
getVmemRatioin interfaceContainersMonitor
-
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<ContainersMonitorEvent>
-