Class FifoScheduler
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode>
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.conf.Configurable,org.apache.hadoop.service.Service,org.apache.hadoop.yarn.event.EventHandler<SchedulerEvent>,Recoverable,ResourceScheduler,YarnScheduler
@LimitedPrivate("yarn")
@Evolving
public class FifoScheduler
extends AbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode>
implements org.apache.hadoop.conf.Configurable
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler
AbstractYarnScheduler.ContainerObjectTypeNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
Fields inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler
activitiesManager, applications, EMPTY_ALLOCATION, lastNodeUpdateTime, minimumAllocation, nmExpireInterval, nmHeartbeatInterval, nodeTracker, readLock, rmContext, schedulerHealth, schedulingMonitorManager, THREAD_JOIN_TIMEOUT_MS, updateInterval, writeLock -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String queue, String user, boolean isAppRecovering, boolean unmanagedAM) voidaddApplicationAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, boolean transferStateFromPreviousAttempt, boolean isAttemptRecovering) allocate(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId, List<org.apache.hadoop.yarn.api.records.ResourceRequest> ask, List<org.apache.hadoop.yarn.api.records.SchedulingRequest> schedulingRequests, List<org.apache.hadoop.yarn.api.records.ContainerId> release, List<String> blacklistAdditions, List<String> blacklistRemovals, ContainerUpdates updateRequests) The main API between the ApplicationMaster and the Scheduler.booleancheckAccess(org.apache.hadoop.security.UserGroupInformation callerUGI, org.apache.hadoop.yarn.api.records.QueueACL acl, String queueName) Check if the user has permission to perform the operation.protected voidcompletedContainerInternal(RMContainer rmContainer, org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus, RMContainerEventType event) List<org.apache.hadoop.yarn.api.records.ApplicationAttemptId>getAppsInQueue(String queueName) Gets the apps under a given queueorg.apache.hadoop.conf.ConfigurationgetConf()intGet the number of nodes available in the cluster.org.apache.hadoop.yarn.api.records.QueueInfogetQueueInfo(String queueName, boolean includeChildQueues, boolean recursive) Get queue information.List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo>Get acls for queues for current user.org.apache.hadoop.yarn.util.resource.ResourceCalculatorgetRMContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId) Get the container for the given containerId.Get the root queue for the scheduler.org.apache.hadoop.yarn.api.records.Resourcevoidhandle(SchedulerEvent event) voidkillContainer(RMContainer container) Kill a RMContainer.protected voidnodeUpdate(RMNode nm) Process a heartbeat update from a node.voidrecover(RMStateStore.RMState state) voidrecoverContainersOnNode(List<org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus> containerReports, RMNode nm) voidreinitialize(org.apache.hadoop.conf.Configuration conf, RMContext rmContext) Re-initialize theResourceScheduler.voidserviceInit(org.apache.hadoop.conf.Configuration conf) voidvoidvoidsetConf(org.apache.hadoop.conf.Configuration conf) voidsetRMContext(RMContext rmContext) Set RMContext forResourceScheduler.Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler
addQueue, asyncContainerRelease, attemptAllocationOnNode, autoCorrectContainerAllocation, checkAndGetApplicationLifetime, checkAndGetApplicationPriority, clearPendingContainerCache, completedContainer, containerIncreasedOnNode, containerLaunchedOnNode, createReleaseCache, createSchedContainerChangeRequests, getActivitiesManager, getApplicationAttempt, getAppResourceUsageReport, getBlacklistedNodes, getClock, getClusterResource, getCurrentAttemptForContainer, getLastNodeUpdateTime, getMaxClusterLevelAppPriority, getMaximumAllocation, getMaximumApplicationLifetime, getMaximumResourceCapability, getMaximumResourceCapability, getMinimumAllocation, getMinimumResourceCapability, getNode, getNodeIds, getNodeReport, getNodes, getNodeTracker, getNormalizedResource, getPendingResourceRequestsForAttempt, getPendingSchedulingRequestsForAttempt, getPlanQueues, getSchedulerAppInfo, getSchedulerApplications, getSchedulerHealth, getSchedulerNode, getSchedulingMonitorManager, getSchedulingResourceTypes, getSkipNodeInterval, getTransferredContainers, handleContainerUpdates, initMaximumResourceCapability, killAllAppsInQueue, moveAllApps, moveApplication, normalizeResourceRequests, normalizeResourceRequests, placementConstraintEnabled, preValidateMoveApplication, refreshMaximumAllocation, releaseContainers, removeQueue, resetSchedulerMetrics, rollbackContainerUpdate, setClock, setClusterMaxPriority, setEntitlement, setLastNodeUpdateTime, shouldContainersBeAutoUpdated, triggerUpdate, update, updateApplicationPriority, updateNodeResource, updateNodeResourceUtilization, updateSchedulerHealthInformationMethods 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, waitForServiceToStop
-
Constructor Details
-
FifoScheduler
public FifoScheduler()
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode> - Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode> - Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode> - Throws:
Exception
-
setConf
public void setConf(org.apache.hadoop.conf.Configuration conf) - Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-
getConf
public org.apache.hadoop.conf.Configuration getConf()- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-
getNumClusterNodes
public int getNumClusterNodes()Description copied from interface:YarnSchedulerGet the number of nodes available in the cluster.- Specified by:
getNumClusterNodesin interfaceYarnScheduler- Returns:
- the number of available nodes.
-
setRMContext
Description copied from interface:ResourceSchedulerSet RMContext forResourceScheduler. This method should be called immediately after instantiating a scheduler once.- Specified by:
setRMContextin interfaceResourceScheduler- Parameters:
rmContext- created by ResourceManager
-
reinitialize
public void reinitialize(org.apache.hadoop.conf.Configuration conf, RMContext rmContext) throws IOException Description copied from interface:ResourceSchedulerRe-initialize theResourceScheduler.- Specified by:
reinitializein interfaceResourceScheduler- Overrides:
reinitializein classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode> - Parameters:
conf- configurationrmContext- RMContext.- Throws:
IOException- an I/O exception has occurred.
-
allocate
public Allocation allocate(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId, List<org.apache.hadoop.yarn.api.records.ResourceRequest> ask, List<org.apache.hadoop.yarn.api.records.SchedulingRequest> schedulingRequests, List<org.apache.hadoop.yarn.api.records.ContainerId> release, List<String> blacklistAdditions, List<String> blacklistRemovals, ContainerUpdates updateRequests) Description copied from interface:YarnSchedulerThe main API between the ApplicationMaster and the Scheduler. The ApplicationMaster may request/update container resources, number of containers, node/rack preference for allocations etc. to the Scheduler.- Specified by:
allocatein interfaceYarnScheduler- Parameters:
applicationAttemptId- the id of the application attempt.ask- the request made by an application to obtain various allocations like host/rack, resource, number of containers, relaxLocality etc., seeResourceRequest.schedulingRequests- similar to ask, but with added ability to specify allocation tags etc., seeSchedulingRequest.release- the list of containers to be released.blacklistAdditions- places (node/rack) to be added to the blacklist.blacklistRemovals- places (node/rack) to be removed from the blacklist.updateRequests- container promotion/demotion updates.- Returns:
- the
Allocationfor the application.
-
addApplication
-
addApplicationAttempt
@VisibleForTesting public void addApplicationAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, boolean transferStateFromPreviousAttempt, boolean isAttemptRecovering) -
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<SchedulerEvent>
-
completedContainerInternal
@Lock(FifoScheduler.class) protected void completedContainerInternal(RMContainer rmContainer, org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus, RMContainerEventType event) - Specified by:
completedContainerInternalin classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode>
-
getQueueInfo
public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, boolean recursive) Description copied from interface:YarnSchedulerGet queue information.- Specified by:
getQueueInfoin interfaceYarnScheduler- Parameters:
queueName- queue nameincludeChildQueues- include child queues?recursive- get children queues?- Returns:
- queue information
-
getQueueUserAclInfo
Description copied from interface:YarnSchedulerGet acls for queues for current user.- Specified by:
getQueueUserAclInfoin interfaceYarnScheduler- Returns:
- acls for queues for current user
-
getResourceCalculator
public org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()- Specified by:
getResourceCalculatorin interfaceYarnScheduler
-
recover
- Specified by:
recoverin interfaceRecoverable
-
getRMContainer
Description copied from interface:YarnSchedulerGet the container for the given containerId.- Specified by:
getRMContainerin interfaceYarnScheduler- Overrides:
getRMContainerin classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode> - Parameters:
containerId- the given containerId.- Returns:
- the container for the given containerId.
-
getRootQueueMetrics
Description copied from interface:YarnSchedulerGet the root queue for the scheduler.- Specified by:
getRootQueueMetricsin interfaceYarnScheduler- Returns:
- the root queue for the scheduler.
-
checkAccess
public boolean checkAccess(org.apache.hadoop.security.UserGroupInformation callerUGI, org.apache.hadoop.yarn.api.records.QueueACL acl, String queueName) Description copied from interface:YarnSchedulerCheck if the user has permission to perform the operation. If the user hasQueueACL.ADMINISTER_QUEUEpermission, this user can view/modify the applications in this queue.- Specified by:
checkAccessin interfaceYarnScheduler- Parameters:
callerUGI- caller UserGroupInformation.acl- queue ACL.queueName- queue Name.- Returns:
trueif the user has the permission,falseotherwise
-
getAppsInQueue
public List<org.apache.hadoop.yarn.api.records.ApplicationAttemptId> getAppsInQueue(String queueName) Description copied from interface:YarnSchedulerGets the apps under a given queue- Specified by:
getAppsInQueuein interfaceYarnScheduler- Parameters:
queueName- the name of the queue.- Returns:
- a collection of app attempt ids in the given queue.
-
getUsedResource
public org.apache.hadoop.yarn.api.records.Resource getUsedResource() -
nodeUpdate
Description copied from class:AbstractYarnSchedulerProcess a heartbeat update from a node.- Overrides:
nodeUpdatein classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode> - Parameters:
nm- The RMNode corresponding to the NodeManager
-
killContainer
Description copied from class:AbstractYarnSchedulerKill a RMContainer. This is meant to be called in tests only to simulate AM container failures.- Specified by:
killContainerin classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode> - Parameters:
container- the container to kill
-
recoverContainersOnNode
public void recoverContainersOnNode(List<org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus> containerReports, RMNode nm) - Overrides:
recoverContainersOnNodein classAbstractYarnScheduler<FifoAppAttempt,FiCaSchedulerNode>
-