Class CapacityScheduler
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode>
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.conf.Configurable,org.apache.hadoop.service.Service,org.apache.hadoop.yarn.event.EventHandler<SchedulerEvent>,Recoverable,CapacitySchedulerContext,ResourceAllocationCommitter,MutableConfScheduler,PreemptableResourceScheduler,ResourceScheduler,YarnScheduler
@LimitedPrivate("yarn")
@Evolving
public class CapacityScheduler
extends AbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode>
implements PreemptableResourceScheduler, CapacitySchedulerContext, org.apache.hadoop.conf.Configurable, ResourceAllocationCommitter, MutableConfScheduler
-
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 TypeMethodDescriptionvoidaddNodes(List<FiCaSchedulerNode> nodesToAdd) Add node to nodeTracker.voidAdd to the scheduler a new Queue.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.booleanattemptAllocationOnNode(SchedulerApplicationAttempt appAttempt, org.apache.hadoop.yarn.api.records.SchedulingRequest schedulingRequest, SchedulerNode schedulerNode) Default implementation.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.longcheckAndGetApplicationLifetime(String queueName, long lifetimeRequestedByApp, RMAppImpl app) Verify whether a submitted application lifetime is valid as per configured Queue lifetime.org.apache.hadoop.yarn.api.records.PrioritycheckAndGetApplicationPriority(org.apache.hadoop.yarn.api.records.Priority priorityRequestedByApp, org.apache.hadoop.security.UserGroupInformation user, String queuePath, org.apache.hadoop.yarn.api.records.ApplicationId applicationId) Verify whether a submitted application priority is valid as per configured Queueprotected voidcompletedContainerInternal(RMContainer rmContainer, org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus, RMContainerEventType event) createResourceCommitRequest(CSAssignment csAssignment) getApplicationAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId) List<org.apache.hadoop.yarn.api.records.ApplicationAttemptId>getAppsInQueue(String queueName) Gets the apps under a given queueList<org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler.AsyncScheduleThread>intorg.apache.hadoop.conf.ConfigurationgetConf()Get the yarn configuration.Get the scheduler configuration.longgetMaximumApplicationLifetime(String queueName) Get maximum lifetime for a queue.org.apache.hadoop.yarn.api.records.ResourcegetMaximumResourceCapability(String queueName) Get maximum allocatableResourcefor the queue specified.Get scheduler's configuration provider, so other classes can directly call mutation APIs on configuration provider.getNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) intintGet the number of nodes available in the cluster.org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler.PendingApplicationComparatorGets the list of names for queues managed by the Reservation System.Get queue object based on queue name.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.ResourceCalculatorGet the root queue for the scheduler.EnumSet<org.apache.hadoop.yarn.proto.YarnServiceProtos.SchedulerResourceTypes>Return a collection of the resource types that are considered when schedulingvoidhandle(SchedulerEvent event) booleanisAmbiguous(String queueName) Determines if a short queue name reference is ambiguous, if there are at least two queues with the same name, it is considered ambiguous.booleanReturns if configuration is mutable.booleanbooleanvoidkillContainer(RMContainer container) Kill a RMContainer.voidkillReservedContainer(RMContainer container) If the scheduler support container reservations, this method is used to ask the scheduler to drop the reservation for the given container.voidmarkContainerForKillable(RMContainer killableContainer) Ask the scheduler to forcibly interrupt the container given as input.voidmarkContainerForPreemption(org.apache.hadoop.yarn.api.records.ApplicationAttemptId aid, RMContainer cont) Ask the scheduler to obtain back the container from a specific application by issuing a preemption requestmoveApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId, String targetQueueName) Moves the given application to the given queue.booleanmoveReservedContainer(RMContainer toBeMovedContainer, FiCaSchedulerNode targetNode) Try to move a reserved container to a targetNode.protected voidnodeUpdate(RMNode rmNode) Process a heartbeat update from a node.normalizeQueueName(String name) Returns the normalized queue name, which should be used for internal queue references.booleanReturning true as capacity scheduler supports placement constraints.voidpreValidateMoveApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId, String newQueue) voidrecover(RMStateStore.RMState state) voidreinitialize(org.apache.hadoop.conf.Configuration newConf, RMContext rmContext) Re-initialize theResourceScheduler.voidreinitialize(org.apache.hadoop.conf.Configuration newConf, RMContext rmContext, boolean validation) voidremoveQueue(String queueName) Remove an existing queue.voidremoveQueue(CSQueue queue) voidReset scheduler metrics.voidserviceInit(org.apache.hadoop.conf.Configuration conf) voidvoidvoidsetAsyncSchedulingConf(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler.AsyncSchedulingConfiguration conf) voidsetConf(org.apache.hadoop.conf.Configuration conf) voidsetEntitlement(String inQueue, QueueEntitlement entitlement) This method increase the entitlement for current queue (must respect invariants, e.g., no overcommit of parents, non negative, etc.).voidvoidvoidsetResourceCalculator(org.apache.hadoop.yarn.util.resource.ResourceCalculator rc) voidsetRMContext(RMContext rmContext) Set RMContext forResourceScheduler.static booleanshouldSkipNodeSchedule(FiCaSchedulerNode node, CapacityScheduler cs, boolean printVerboseLog) voidsubmitResourceCommitRequest(org.apache.hadoop.yarn.api.records.Resource cluster, CSAssignment csAssignment) booleantryCommit(org.apache.hadoop.yarn.api.records.Resource cluster, ResourceCommitRequest r, boolean updatePending) Try to commit the allocation Proposal.org.apache.hadoop.yarn.api.records.PriorityupdateApplicationPriority(org.apache.hadoop.yarn.api.records.Priority newPriority, org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.thirdparty.com.google.common.util.concurrent.SettableFuture<Object> future, org.apache.hadoop.security.UserGroupInformation user) Change application priority of a submitted application at runtimevoidMethods inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler
asyncContainerRelease, autoCorrectContainerAllocation, clearPendingContainerCache, completedContainer, containerIncreasedOnNode, containerLaunchedOnNode, createReleaseCache, createSchedContainerChangeRequests, getActivitiesManager, getAppResourceUsageReport, getBlacklistedNodes, getClock, getClusterResource, getCurrentAttemptForContainer, getLastNodeUpdateTime, getMaxClusterLevelAppPriority, getMaximumAllocation, getMaximumResourceCapability, getMinimumAllocation, getMinimumResourceCapability, getNodeIds, getNodeReport, getNodes, getNodeTracker, getNormalizedResource, getPendingResourceRequestsForAttempt, getPendingSchedulingRequestsForAttempt, getRMContainer, getSchedulerAppInfo, getSchedulerApplications, getSchedulerHealth, getSchedulerNode, getSchedulingMonitorManager, getSkipNodeInterval, getTransferredContainers, handleContainerUpdates, initMaximumResourceCapability, killAllAppsInQueue, moveAllApps, normalizeResourceRequests, normalizeResourceRequests, recoverContainersOnNode, refreshMaximumAllocation, releaseContainers, rollbackContainerUpdate, setClock, setClusterMaxPriority, setLastNodeUpdateTime, shouldContainersBeAutoUpdated, triggerUpdate, update, 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, waitForServiceToStopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerContext
getActivitiesManager, getClock, getClusterResource, getLastNodeUpdateTime, getMaxClusterLevelAppPriority, getMaximumResourceCapability, getMinimumResourceCapability, getSchedulerHealthMethods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler
getNodeIdsMethods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler
getAppResourceUsageReport, getClusterResource, getMaxClusterLevelAppPriority, getMaximumResourceCapability, getMinimumResourceCapability, getNodeReport, getNormalizedResource, getPendingResourceRequestsForAttempt, getPendingSchedulingRequestsForAttempt, getRMContainer, getSchedulerAppInfo, getSchedulerNode, getTransferredContainers, killAllAppsInQueue, moveAllApps, setClusterMaxPriority
-
Constructor Details
-
CapacityScheduler
public CapacityScheduler()
-
-
Method Details
-
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()Description copied from interface:CapacitySchedulerContextGet the yarn configuration.- Specified by:
getConfin interfaceCapacitySchedulerContext- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable- Returns:
- yarn configuration.
-
getRootQueueMetrics
Description copied from interface:YarnSchedulerGet the root queue for the scheduler.- Specified by:
getRootQueueMetricsin interfaceYarnScheduler- Returns:
- the root queue for the scheduler.
-
getRootQueue
-
getConfiguration
Description copied from interface:MutableConfSchedulerGet the scheduler configuration.- Specified by:
getConfigurationin interfaceCapacitySchedulerContext- Specified by:
getConfigurationin interfaceMutableConfScheduler- Returns:
- the scheduler configuration
-
getQueueContext
- Specified by:
getQueueContextin interfaceCapacitySchedulerContext
-
getContainerTokenSecretManager
- Specified by:
getContainerTokenSecretManagerin interfaceCapacitySchedulerContext
-
getResourceCalculator
public org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()- Specified by:
getResourceCalculatorin interfaceCapacitySchedulerContext- Specified by:
getResourceCalculatorin interfaceYarnScheduler
-
setResourceCalculator
@VisibleForTesting public void setResourceCalculator(org.apache.hadoop.yarn.util.resource.ResourceCalculator rc) -
getNumClusterNodes
public int getNumClusterNodes()Description copied from interface:YarnSchedulerGet the number of nodes available in the cluster.- Specified by:
getNumClusterNodesin interfaceCapacitySchedulerContext- Specified by:
getNumClusterNodesin interfaceYarnScheduler- Returns:
- the number of available nodes.
-
getRMContext
- Specified by:
getRMContextin interfaceCapacitySchedulerContext
-
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
-
serviceInit
- Overrides:
serviceInitin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Throws:
Exception
-
reinitialize
public void reinitialize(org.apache.hadoop.conf.Configuration newConf, RMContext rmContext, boolean validation) throws IOException - Throws:
IOException
-
reinitialize
public void reinitialize(org.apache.hadoop.conf.Configuration newConf, RMContext rmContext) throws IOException Description copied from interface:ResourceSchedulerRe-initialize theResourceScheduler.- Specified by:
reinitializein interfaceResourceScheduler- Overrides:
reinitializein classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
newConf- configurationrmContext- RMContext.- Throws:
IOException- an I/O exception has occurred.
-
shouldSkipNodeSchedule
@VisibleForTesting public static boolean shouldSkipNodeSchedule(FiCaSchedulerNode node, CapacityScheduler cs, boolean printVerboseLog) -
setAsyncSchedulingConf
@VisibleForTesting public void setAsyncSchedulingConf(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler.AsyncSchedulingConfiguration conf) -
getCSMappingPlacementRule
- Throws:
IOException
-
updatePlacementRules
- Throws:
IOException
-
getQueue
Description copied from interface:MutableConfSchedulerGet queue object based on queue name.- Specified by:
getQueuein interfaceMutableConfScheduler- Parameters:
queueName- the queue name- Returns:
- the queue object
-
normalizeQueueName
Returns the normalized queue name, which should be used for internal queue references. Currently this is the fullQueuename which disambiguously identifies a queue.- Parameters:
name- Name of the queue to be normalized- Returns:
- The normalized (full name) of the queue
-
isAmbiguous
Determines if a short queue name reference is ambiguous, if there are at least two queues with the same name, it is considered ambiguous. Otherwise it is not.- Parameters:
queueName- The name of the queue to check for ambiguity- Returns:
- true if there are at least 2 queues with the same name
-
allocate
@Lock(org.apache.hadoop.yarn.server.utils.Lock.NoLock.class) 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.
-
getQueueInfo
@Lock(org.apache.hadoop.yarn.server.utils.Lock.NoLock.class) public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, boolean recursive) throws IOException 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
- Throws:
IOException- an I/O exception has occurred.
-
getQueueUserAclInfo
@Lock(org.apache.hadoop.yarn.server.utils.Lock.NoLock.class) public List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> getQueueUserAclInfo()Description copied from interface:YarnSchedulerGet acls for queues for current user.- Specified by:
getQueueUserAclInfoin interfaceYarnScheduler- Returns:
- acls for queues for current user
-
nodeUpdate
Description copied from class:AbstractYarnSchedulerProcess a heartbeat update from a node.- Overrides:
nodeUpdatein classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
rmNode- The RMNode corresponding to the NodeManager
-
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<SchedulerEvent>
-
addNodes
Add node to nodeTracker. Used when validating CS configuration by instantiating a new CS instance.- Parameters:
nodesToAdd- node to be added
-
completedContainerInternal
protected void completedContainerInternal(RMContainer rmContainer, org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus, RMContainerEventType event) - Specified by:
completedContainerInternalin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode>
-
getApplicationAttempt
@Lock(org.apache.hadoop.yarn.server.utils.Lock.NoLock.class) @VisibleForTesting public FiCaSchedulerApp getApplicationAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId) - Specified by:
getApplicationAttemptin interfaceCapacitySchedulerContext- Overrides:
getApplicationAttemptin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode>
-
getNode
@Lock(org.apache.hadoop.yarn.server.utils.Lock.NoLock.class) public FiCaSchedulerNode getNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) - Specified by:
getNodein interfaceCapacitySchedulerContext- Overrides:
getNodein classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode>
-
getAllNodes
@Lock(org.apache.hadoop.yarn.server.utils.Lock.NoLock.class) public List<FiCaSchedulerNode> getAllNodes() -
recover
@Lock(org.apache.hadoop.yarn.server.utils.Lock.NoLock.class) public void recover(RMStateStore.RMState state) throws Exception - Specified by:
recoverin interfaceRecoverable- Throws:
Exception
-
killReservedContainer
Description copied from interface:PreemptableResourceSchedulerIf the scheduler support container reservations, this method is used to ask the scheduler to drop the reservation for the given container.- Specified by:
killReservedContainerin interfacePreemptableResourceScheduler- Parameters:
container- Reference to reserved container allocation.
-
markContainerForPreemption
public void markContainerForPreemption(org.apache.hadoop.yarn.api.records.ApplicationAttemptId aid, RMContainer cont) Description copied from interface:PreemptableResourceSchedulerAsk the scheduler to obtain back the container from a specific application by issuing a preemption request- Specified by:
markContainerForPreemptionin interfacePreemptableResourceScheduler- Parameters:
aid- the application from which we want to get a container backcont- the container we want back
-
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<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
container- the container to kill
-
markContainerForKillable
Description copied from interface:PreemptableResourceSchedulerAsk the scheduler to forcibly interrupt the container given as input.- Specified by:
markContainerForKillablein interfacePreemptableResourceScheduler- Parameters:
killableContainer- RMContainer.
-
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.
-
isSystemAppsLimitReached
public boolean isSystemAppsLimitReached() -
removeQueue
Description copied from interface:YarnSchedulerRemove an existing queue. Implementations might limit when a queue could be removed (e.g., must have zero entitlement, and no applications running, or must be a leaf, etc..).- Specified by:
removeQueuein interfaceYarnScheduler- Overrides:
removeQueuein classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
queueName- name of the queue to remove- Throws:
SchedulerDynamicEditException
-
removeQueue
- Throws:
SchedulerDynamicEditException
-
addQueue
Description copied from interface:YarnSchedulerAdd to the scheduler a new Queue. Implementations might limit what type of queues can be dynamically added (e.g., Queue must be a leaf, must be attached to existing parent, must have zero entitlement).- Specified by:
addQueuein interfaceYarnScheduler- Overrides:
addQueuein classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
queue- the queue being added.- Throws:
IOException- when io exception occur.SchedulerDynamicEditException
-
setEntitlement
public void setEntitlement(String inQueue, QueueEntitlement entitlement) throws org.apache.hadoop.yarn.exceptions.YarnException Description copied from interface:YarnSchedulerThis method increase the entitlement for current queue (must respect invariants, e.g., no overcommit of parents, non negative, etc.). Entitlement is a general term for weights in FairScheduler, capacity for the CapacityScheduler, etc.- Specified by:
setEntitlementin interfaceYarnScheduler- Overrides:
setEntitlementin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
inQueue- the queue for which we change entitlemententitlement- the new entitlement for the queue (capacity, maxCapacity, etc..)- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- when yarn exception occur.
-
moveApplication
public String moveApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId, String targetQueueName) throws org.apache.hadoop.yarn.exceptions.YarnException Description copied from interface:YarnSchedulerMoves the given application to the given queue.- Specified by:
moveApplicationin interfaceYarnScheduler- Overrides:
moveApplicationin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
appId- application IdtargetQueueName- the given queue.- Returns:
- the name of the queue the application was placed into
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if the move cannot be carried out
-
preValidateMoveApplication
public void preValidateMoveApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId, String newQueue) throws org.apache.hadoop.yarn.exceptions.YarnException - Specified by:
preValidateMoveApplicationin interfaceYarnScheduler- Overrides:
preValidateMoveApplicationin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
appId- Application IDnewQueue- Target QueueName- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if the pre-validation for move cannot be carried out
-
getSchedulingResourceTypes
public EnumSet<org.apache.hadoop.yarn.proto.YarnServiceProtos.SchedulerResourceTypes> getSchedulingResourceTypes()Return a collection of the resource types that are considered when scheduling- Specified by:
getSchedulingResourceTypesin interfaceYarnScheduler- Overrides:
getSchedulingResourceTypesin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Returns:
- an EnumSet containing the resource types
-
getMaximumResourceCapability
Description copied from interface:YarnSchedulerGet maximum allocatableResourcefor the queue specified.- Specified by:
getMaximumResourceCapabilityin interfaceCapacitySchedulerContext- Specified by:
getMaximumResourceCapabilityin interfaceYarnScheduler- Overrides:
getMaximumResourceCapabilityin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
queueName- queue name- Returns:
- maximum allocatable resource
-
getPlanQueues
Description copied from interface:YarnSchedulerGets the list of names for queues managed by the Reservation System.- Specified by:
getPlanQueuesin interfaceYarnScheduler- Overrides:
getPlanQueuesin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Returns:
- the list of queues which support reservations
-
checkAndGetApplicationPriority
public org.apache.hadoop.yarn.api.records.Priority checkAndGetApplicationPriority(org.apache.hadoop.yarn.api.records.Priority priorityRequestedByApp, org.apache.hadoop.security.UserGroupInformation user, String queuePath, org.apache.hadoop.yarn.api.records.ApplicationId applicationId) throws org.apache.hadoop.yarn.exceptions.YarnException Description copied from interface:YarnSchedulerVerify whether a submitted application priority is valid as per configured Queue- Specified by:
checkAndGetApplicationPriorityin interfaceYarnScheduler- Overrides:
checkAndGetApplicationPriorityin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
priorityRequestedByApp- Submitted Application priority.user- User who submitted the ApplicationqueuePath- Name of the QueueapplicationId- Application ID- Returns:
- Updated Priority from scheduler
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- when yarn exception occur.
-
updateApplicationPriority
public org.apache.hadoop.yarn.api.records.Priority updateApplicationPriority(org.apache.hadoop.yarn.api.records.Priority newPriority, org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.thirdparty.com.google.common.util.concurrent.SettableFuture<Object> future, org.apache.hadoop.security.UserGroupInformation user) throws org.apache.hadoop.yarn.exceptions.YarnException Description copied from interface:YarnSchedulerChange application priority of a submitted application at runtime- Specified by:
updateApplicationPriorityin interfaceYarnScheduler- Overrides:
updateApplicationPriorityin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
newPriority- Submitted Application priority.applicationId- Application IDfuture- Sets any type of exception happened from StateStoreuser- who submitted the application- Returns:
- updated priority
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- when yarn exception occur.
-
getPreemptionManager
- Specified by:
getPreemptionManagerin interfaceCapacitySchedulerContext
-
getClusterResourceUsage
- Specified by:
getClusterResourceUsagein interfaceCapacitySchedulerContext- Returns:
- QueueCapacities root queue of the Capacity Scheduler Queue, root queue used capacities for different labels are same as that of the cluster.
-
submitResourceCommitRequest
@VisibleForTesting public void submitResourceCommitRequest(org.apache.hadoop.yarn.api.records.Resource cluster, CSAssignment csAssignment) -
attemptAllocationOnNode
public boolean attemptAllocationOnNode(SchedulerApplicationAttempt appAttempt, org.apache.hadoop.yarn.api.records.SchedulingRequest schedulingRequest, SchedulerNode schedulerNode) Description copied from class:AbstractYarnSchedulerDefault implementation. Always returns false.- Specified by:
attemptAllocationOnNodein interfaceResourceScheduler- Overrides:
attemptAllocationOnNodein classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
appAttempt- ApplicationAttempt.schedulingRequest- SchedulingRequest.schedulerNode- SchedulerNode.- Returns:
- Success or not.
-
createResourceCommitRequest
@VisibleForTesting public ResourceCommitRequest<FiCaSchedulerApp,FiCaSchedulerNode> createResourceCommitRequest(CSAssignment csAssignment) -
tryCommit
public boolean tryCommit(org.apache.hadoop.yarn.api.records.Resource cluster, ResourceCommitRequest r, boolean updatePending) Description copied from interface:ResourceAllocationCommitterTry to commit the allocation Proposal. This also gives the option of not updating a pending queued request.- Specified by:
tryCommitin interfaceResourceAllocationCommitter- Parameters:
cluster- Cluster Resource.r- Proposal.updatePending- Decrement pending if successful.- Returns:
- Is successful or not.
-
getAsyncSchedulingPendingBacklogs
public int getAsyncSchedulingPendingBacklogs() -
getCapacitySchedulerQueueManager
- Specified by:
getCapacitySchedulerQueueManagerin interfaceCapacitySchedulerContext
-
getWorkflowPriorityMappingsManager
-
moveReservedContainer
Try to move a reserved container to a targetNode. If the targetNode is reserved by another application (other than this one). The previous reservation will be cancelled.- Parameters:
toBeMovedContainer- reserved container will be movedtargetNode- targetNode- Returns:
- true if move succeeded. Return false if the targetNode is reserved by a different container or move failed because of any other reasons.
-
checkAndGetApplicationLifetime
public long checkAndGetApplicationLifetime(String queueName, long lifetimeRequestedByApp, RMAppImpl app) Description copied from interface:YarnSchedulerVerify whether a submitted application lifetime is valid as per configured Queue lifetime.- Specified by:
checkAndGetApplicationLifetimein interfaceYarnScheduler- Overrides:
checkAndGetApplicationLifetimein classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
queueName- Name of the QueuelifetimeRequestedByApp- configured application lifetimeapp- details of app- Returns:
- valid lifetime as per queue
-
getMaximumApplicationLifetime
Description copied from interface:YarnSchedulerGet maximum lifetime for a queue.- Specified by:
getMaximumApplicationLifetimein interfaceYarnScheduler- Overrides:
getMaximumApplicationLifetimein classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Parameters:
queueName- to get lifetime- Returns:
- maximum lifetime in seconds
-
isConfigurationMutable
public boolean isConfigurationMutable()Description copied from interface:CapacitySchedulerContextReturns if configuration is mutable.- Specified by:
isConfigurationMutablein interfaceCapacitySchedulerContext- Specified by:
isConfigurationMutablein interfaceMutableConfScheduler- Returns:
- if configuration is mutable
-
getMutableConfProvider
Description copied from interface:MutableConfSchedulerGet scheduler's configuration provider, so other classes can directly call mutation APIs on configuration provider.- Specified by:
getMutableConfProviderin interfaceMutableConfScheduler- Returns:
- scheduler's configuration provider
-
getCsConfProvider
-
resetSchedulerMetrics
public void resetSchedulerMetrics()Description copied from interface:ResourceSchedulerReset scheduler metrics.- Specified by:
resetSchedulerMetricsin interfaceResourceScheduler- Overrides:
resetSchedulerMetricsin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode>
-
isMultiNodePlacementEnabled
public boolean isMultiNodePlacementEnabled() -
getNumAsyncSchedulerThreads
public int getNumAsyncSchedulerThreads() -
setMaxRunningAppsEnforcer
-
placementConstraintEnabled
public boolean placementConstraintEnabled()Returning true as capacity scheduler supports placement constraints.- Overrides:
placementConstraintEnabledin classAbstractYarnScheduler<FiCaSchedulerApp,FiCaSchedulerNode> - Returns:
- enabled or not
-
setQueueManager
-
getAsyncSchedulerThreads
@VisibleForTesting public List<org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler.AsyncScheduleThread> getAsyncSchedulerThreads() -
getPendingApplicationComparator
public org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler.PendingApplicationComparator getPendingApplicationComparator()- Specified by:
getPendingApplicationComparatorin interfaceCapacitySchedulerContext
-