diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java index d166e5fc568..eb7fba69abb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java @@ -62,8 +62,12 @@ List getQueueUserAclInfo(UserGroupInformation user); boolean hasAccess(QueueACL acl, UserGroupInformation user); - - public AbstractUsersManager getAbstractUsersManager(); + + /** + * Get manager which tracks users in the system. + * @return manager + */ + AbstractUsersManager getAbstractUsersManager(); /** * Recover the state of the queue for a given container. @@ -71,7 +75,7 @@ * @param schedulerAttempt the application for which the container was allocated * @param rmContainer the container that was recovered. */ - public void recoverContainer(Resource clusterResource, + void recoverContainer(Resource clusterResource, SchedulerApplicationAttempt schedulerAttempt, RMContainer rmContainer); /** @@ -81,7 +85,7 @@ public void recoverContainer(Resource clusterResource, * labels={a, b, c} means this queue can access a or b or c * @return labels */ - public Set getAccessibleNodeLabels(); + Set getAccessibleNodeLabels(); /** * Get default label expression of this queue. If label expression of @@ -90,7 +94,7 @@ public void recoverContainer(Resource clusterResource, * * @return default label expression */ - public String getDefaultNodeLabelExpression(); + String getDefaultNodeLabelExpression(); /** * When new outstanding resource is asked, calling this will increase pending @@ -99,7 +103,7 @@ public void recoverContainer(Resource clusterResource, * @param nodeLabel asked by application * @param resourceToInc new resource asked */ - public void incPendingResource(String nodeLabel, Resource resourceToInc); + void incPendingResource(String nodeLabel, Resource resourceToInc); /** * When an outstanding resource is fulfilled or canceled, calling this will @@ -110,14 +114,14 @@ public void recoverContainer(Resource clusterResource, * @param resourceToDec * new resource asked */ - public void decPendingResource(String nodeLabel, Resource resourceToDec); + void decPendingResource(String nodeLabel, Resource resourceToDec); /** * Get the Default Application Priority for this queue * * @return default application priority */ - public Priority getDefaultApplicationPriority(); + Priority getDefaultApplicationPriority(); /** * Increment Reserved Capacity @@ -127,7 +131,7 @@ public void recoverContainer(Resource clusterResource, * @param reservedRes * reserved resource asked */ - public void incReservedResource(String partition, Resource reservedRes); + void incReservedResource(String partition, Resource reservedRes); /** * Decrement Reserved Capacity @@ -137,5 +141,5 @@ public void recoverContainer(Resource clusterResource, * @param reservedRes * reserved resource asked */ - public void decReservedResource(String partition, Resource reservedRes); + void decReservedResource(String partition, Resource reservedRes); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java index d95fe7d0fd6..420c1fbc47b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java @@ -70,16 +70,16 @@ */ @Public @Stable - public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, + QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, boolean recursive) throws IOException; /** - * Get acls for queues for current user. - * @return acls for queues for current user + * Get ACLs for queues for current user. + * @return ACLs for queues for current user */ @Public @Stable - public List getQueueUserAclInfo(); + List getQueueUserAclInfo(); /** * Get the whole resource capacity of the cluster. @@ -87,7 +87,7 @@ public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, */ @LimitedPrivate("yarn") @Unstable - public Resource getClusterResource(); + Resource getClusterResource(); /** * Get minimum allocatable {@link Resource}. @@ -95,7 +95,7 @@ public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, */ @Public @Stable - public Resource getMinimumResourceCapability(); + Resource getMinimumResourceCapability(); /** * Get maximum allocatable {@link Resource} at the cluster level. @@ -103,7 +103,7 @@ public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, */ @Public @Stable - public Resource getMaximumResourceCapability(); + Resource getMaximumResourceCapability(); /** * Get maximum allocatable {@link Resource} for the queue specified. @@ -112,8 +112,12 @@ public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, */ @Public @Stable - public Resource getMaximumResourceCapability(String queueName); + Resource getMaximumResourceCapability(String queueName); + /** + * Get resource calculator. + * @return calculator + */ @LimitedPrivate("yarn") @Evolving ResourceCalculator getResourceCalculator(); @@ -124,20 +128,23 @@ public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, */ @Public @Stable - public int getNumClusterNodes(); + int getNumClusterNodes(); /** * The main api between the ApplicationMaster and the Scheduler. * The ApplicationMaster is updating his future resource requirements - * and may release containers he doens't need. + * and may release containers he doesn't need. * - * @param appAttemptId - * @param ask - * @param schedulingRequests - * @param release - * @param blacklistAdditions - * @param blacklistRemovals - * @param updateRequests @return the {@link Allocation} for the application + * @param appAttemptId appAttemptId + * @param ask list of {@link ResourceRequest}s + * @param schedulingRequests list of {@link SchedulingRequest}s + * @param release list of {@link ContainerId}s maybe released + * @param blacklistAdditions list of resource-names which should be added to + * the application blacklist + * @param blacklistRemovals list of resource-names which should be removed + * from the application blacklist + * @param updateRequests container update requests + * @return the {@link Allocation} for the application */ @Public @Stable @@ -148,13 +155,13 @@ Allocation allocate(ApplicationAttemptId appAttemptId, /** * Get node resource usage report. - * @param nodeId + * @param nodeId nodeId * @return the {@link SchedulerNodeReport} for the node or null * if nodeId does not point to a defined node. */ @LimitedPrivate("yarn") @Stable - public SchedulerNodeReport getNodeReport(NodeId nodeId); + SchedulerNodeReport getNodeReport(NodeId nodeId); /** * Get the Scheduler app for a given app attempt Id. @@ -187,9 +194,9 @@ ApplicationResourceUsageReport getAppResourceUsageReport( * Check if the user has permission to perform the operation. * If the user has {@link QueueACL#ADMINISTER_QUEUE} permission, * this user can view/modify the applications in this queue - * @param callerUGI - * @param acl - * @param queueName + * @param callerUGI UGI + * @param acl ACL for the specified queue + * @param queueName the queue name for check * @return true if the user has the permission, * false otherwise */ @@ -203,46 +210,47 @@ boolean checkAccess(UserGroupInformation callerUGI, */ @LimitedPrivate("yarn") @Stable - public List getAppsInQueue(String queueName); + List getAppsInQueue(String queueName); /** * Get the container for the given containerId. - * @param containerId + * @param containerId containerId * @return the container for the given containerId. */ @LimitedPrivate("yarn") @Unstable - public RMContainer getRMContainer(ContainerId containerId); + RMContainer getRMContainer(ContainerId containerId); /** * Moves the given application to the given queue - * @param appId - * @param newQueue + * @param appId Application ID + * @param newQueue Target QueueName * @return the name of the queue the application was placed into * @throws YarnException if the move cannot be carried out */ @LimitedPrivate("yarn") @Evolving - public String moveApplication(ApplicationId appId, String newQueue) + String moveApplication(ApplicationId appId, String newQueue) throws YarnException; /** - * + * Pre-validate move application request to check for any access violations + * or other errors. If there are any violations, YarnException will be thrown. * @param appId Application ID * @param newQueue Target QueueName * @throws YarnException if the pre-validation for move cannot be carried out */ @LimitedPrivate("yarn") @Evolving - public void preValidateMoveApplication(ApplicationId appId, + void preValidateMoveApplication(ApplicationId appId, String newQueue) throws YarnException; /** * Completely drain sourceQueue of applications, by moving all of them to * destQueue. * - * @param sourceQueue - * @param destQueue + * @param sourceQueue source queue + * @param destQueue dest queue * @throws YarnException */ void moveAllApps(String sourceQueue, String destQueue) throws YarnException; @@ -293,7 +301,7 @@ void setEntitlement(String queue, QueueEntitlement entitlement) * Gets the list of names for queues managed by the Reservation System * @return the list of queues which support reservations */ - public Set getPlanQueues() throws YarnException; + Set getPlanQueues() throws YarnException; /** * Return a collection of the resource types that are considered when @@ -301,10 +309,9 @@ void setEntitlement(String queue, QueueEntitlement entitlement) * * @return an EnumSet containing the resource types */ - public EnumSet getSchedulingResourceTypes(); + EnumSet getSchedulingResourceTypes(); /** - * * Verify whether a submitted application priority is valid as per configured * Queue * @@ -318,12 +325,11 @@ void setEntitlement(String queue, QueueEntitlement entitlement) * Application ID * @return Updated Priority from scheduler */ - public Priority checkAndGetApplicationPriority(Priority priorityRequestedByApp, + Priority checkAndGetApplicationPriority(Priority priorityRequestedByApp, UserGroupInformation user, String queueName, ApplicationId applicationId) throws YarnException; /** - * * Change application priority of a submitted application at runtime * * @param newPriority Submitted Application priority. @@ -335,12 +341,11 @@ public Priority checkAndGetApplicationPriority(Priority priorityRequestedByApp, * * @return updated priority */ - public Priority updateApplicationPriority(Priority newPriority, + Priority updateApplicationPriority(Priority newPriority, ApplicationId applicationId, SettableFuture future, UserGroupInformation user) throws YarnException; /** - * * Get previous attempts' live containers for work-preserving AM restart. * * @param appAttemptId the id of the application attempt @@ -352,13 +357,16 @@ public Priority updateApplicationPriority(Priority newPriority, /** * Set the cluster max priority * - * @param conf + * @param conf config * @throws YarnException */ void setClusterMaxPriority(Configuration conf) throws YarnException; /** - * @param attemptId + * Get pending resource requests for specified application attempt. + * + * @param attemptId the id of the application attempt + * @return pending resource requests */ List getPendingResourceRequestsForAttempt( ApplicationAttemptId attemptId); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/OrderingPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/OrderingPolicy.java index 9aacc7e79a4..7c2e9660305 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/OrderingPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/OrderingPolicy.java @@ -40,7 +40,7 @@ * Assignment and Preemption iterator with no guarantees regarding order. * @return a collection of {@link SchedulableEntity} objects */ - public Collection getSchedulableEntities(); + Collection getSchedulableEntities(); /** * Return an iterator over the collection of {@link SchedulableEntity} @@ -48,21 +48,21 @@ * @return an iterator over the collection of {@link SchedulableEntity} * objects */ - public Iterator getAssignmentIterator(); + Iterator getAssignmentIterator(); /** * Return an iterator over the collection of {@link SchedulableEntity} * objects which orders them for preemption. * @return an iterator over the collection of {@link SchedulableEntity} */ - public Iterator getPreemptionIterator(); + Iterator getPreemptionIterator(); /** * Add a {@link SchedulableEntity} to be managed for allocation and preemption * ordering. * @param s the {@link SchedulableEntity} to add */ - public void addSchedulableEntity(S s); + void addSchedulableEntity(S s); /** * Remove a {@link SchedulableEntity} from management for allocation and @@ -71,28 +71,28 @@ * @return whether the {@link SchedulableEntity} was present before this * operation */ - public boolean removeSchedulableEntity(S s); + boolean removeSchedulableEntity(S s); /** * Add a collection of {@link SchedulableEntity} objects to be managed for * allocation and preemption ordering. * @param sc the collection of {@link SchedulableEntity} objects to add */ - public void addAllSchedulableEntities(Collection sc); + void addAllSchedulableEntities(Collection sc); /** * Get the number of {@link SchedulableEntity} objects managed for allocation * and preemption ordering. * @return the number of {@link SchedulableEntity} objects */ - public int getNumSchedulableEntities(); + int getNumSchedulableEntities(); /** * Provides configuration information for the policy from the scheduler * configuration. * @param conf a map of scheduler configuration properties and values */ - public void configure(Map conf); + void configure(Map conf); /** * Notify the {@code OrderingPolicy} that the {@link SchedulableEntity} @@ -102,7 +102,7 @@ * @param schedulableEntity the {@link SchedulableEntity} * @param r the allocated {@link RMContainer} */ - public void containerAllocated(S schedulableEntity, RMContainer r); + void containerAllocated(S schedulableEntity, RMContainer r); /** * Notify the {@code OrderingPolicy} that the {@link SchedulableEntity} @@ -112,7 +112,7 @@ * @param schedulableEntity the {@link SchedulableEntity} * @param r the released {@link RMContainer} */ - public void containerReleased(S schedulableEntity, RMContainer r); + void containerReleased(S schedulableEntity, RMContainer r); /** * Notify the {@code OrderingPolicy} that the demand for the @@ -126,6 +126,6 @@ * Return information regarding configuration and status. * @return configuration and status information */ - public String getInfo(); + String getInfo(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/SchedulableEntity.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/SchedulableEntity.java index 41b83ce7162..3ea87f3fc68 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/SchedulableEntity.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/SchedulableEntity.java @@ -31,28 +31,28 @@ /** * Id - each entity must have a unique id */ - public String getId(); + String getId(); /** * Compare the passed SchedulableEntity to this one for input order. * Input order is implementation defined and should reflect the * correct ordering for first-in first-out processing */ - public int compareInputOrderTo(SchedulableEntity other); + int compareInputOrderTo(SchedulableEntity other); /** * View of Resources wanted and consumed by the entity */ - public ResourceUsage getSchedulingResourceUsage(); + ResourceUsage getSchedulingResourceUsage(); /** * Get the priority of the application */ - public Priority getPriority(); + Priority getPriority(); /** * Whether application was running before RM restart. */ - public boolean isRecovering(); + boolean isRecovering(); }