Class ContainerScheduler
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.nodemanager.containermanager.scheduler.ContainerScheduler
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service,org.apache.hadoop.yarn.event.EventHandler<ContainerSchedulerEvent>
public class ContainerScheduler
extends org.apache.hadoop.service.AbstractService
implements org.apache.hadoop.yarn.event.EventHandler<ContainerSchedulerEvent>
The ContainerScheduler manages a collection of runnable containers. It
ensures that a container is launched only if all its launch criteria are
met. It also ensures that OPPORTUNISTIC containers are killed to make
room for GUARANTEED containers.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
ConstructorsConstructorDescriptionContainerScheduler(Context context, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, NodeManagerMetrics metrics) Instantiate a Container Scheduler.ContainerScheduler(Context context, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, NodeManagerMetrics metrics, int qLength) ContainerScheduler(Context context, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, NodeManagerMetrics metrics, OpportunisticContainersQueuePolicy oppContainersQueuePolicy, int qLength) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.yarn.api.records.ResourceUtilizationintReturn number of queued containers.intintintorg.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatusintReturn the capacity of the queue for opportunistic containers on this node.voidhandle(ContainerSchedulerEvent event) Handle ContainerSchedulerEvents.voidPopulates auxiliary data structures used by the ContainerScheduler on recovery.protected voidscheduleContainer(Container container) voidserviceInit(org.apache.hadoop.conf.Configuration conf) voidsetUsePauseEventForPreemption(boolean usePauseEventForPreemption) voidupdateQueuingLimit(org.apache.hadoop.yarn.server.api.records.ContainerQueuingLimit limit) 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, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
ContainerScheduler
public ContainerScheduler(Context context, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, NodeManagerMetrics metrics) Instantiate a Container Scheduler.- Parameters:
context- NodeManager Context.dispatcher- AsyncDispatcher.metrics- NodeManagerMetrics.
-
ContainerScheduler
@VisibleForTesting public ContainerScheduler(Context context, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, NodeManagerMetrics metrics, int qLength) -
ContainerScheduler
@VisibleForTesting public ContainerScheduler(Context context, org.apache.hadoop.yarn.event.AsyncDispatcher dispatcher, NodeManagerMetrics metrics, OpportunisticContainersQueuePolicy oppContainersQueuePolicy, int qLength)
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
handle
Handle ContainerSchedulerEvents.- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<ContainerSchedulerEvent>- Parameters:
event- ContainerSchedulerEvent.
-
recoverActiveContainer
public void recoverActiveContainer(Container container, NMStateStoreService.RecoveredContainerState rcs) Populates auxiliary data structures used by the ContainerScheduler on recovery.- Parameters:
container- container recoveredrcs- Recovered Container status
-
getNumQueuedContainers
public int getNumQueuedContainers()Return number of queued containers.- Returns:
- Number of queued containers.
-
getOpportunisticQueueCapacity
public int getOpportunisticQueueCapacity()Return the capacity of the queue for opportunistic containers on this node.- Returns:
- queue capacity.
-
getNumQueuedGuaranteedContainers
@VisibleForTesting public int getNumQueuedGuaranteedContainers() -
getNumQueuedOpportunisticContainers
@VisibleForTesting public int getNumQueuedOpportunisticContainers() -
getNumRunningContainers
@VisibleForTesting public int getNumRunningContainers() -
setUsePauseEventForPreemption
@VisibleForTesting public void setUsePauseEventForPreemption(boolean usePauseEventForPreemption) -
getOpportunisticContainersStatus
public org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus getOpportunisticContainersStatus() -
scheduleContainer
-
updateQueuingLimit
public void updateQueuingLimit(org.apache.hadoop.yarn.server.api.records.ContainerQueuingLimit limit) -
getContainersMonitor
-
getCurrentUtilization
@VisibleForTesting public org.apache.hadoop.yarn.api.records.ResourceUtilization getCurrentUtilization()
-