Class UsersManager
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.UsersManager
- All Implemented Interfaces:
AbstractUsersManager
UsersManager tracks users in the system and its respective data
structures.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classUser class stores all user related resource usage, application details. -
Constructor Summary
ConstructorsConstructorDescriptionUsersManager(QueueMetrics metrics, AbstractLeafQueue lQueue, RMNodeLabelsManager labelManager, org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator) UsersManager Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateApplication(String user, org.apache.hadoop.yarn.api.records.ApplicationId applicationId) An application has new outstanding requests.voiddeactivateApplication(String user, org.apache.hadoop.yarn.api.records.ApplicationId applicationId) An application has no more outstanding requests.org.apache.hadoop.yarn.api.records.ResourcegetComputedResourceLimitForActiveUsers(String userName, org.apache.hadoop.yarn.api.records.Resource clusterResource, String nodePartition, SchedulingMode schedulingMode) Get computed user-limit for all ACTIVE users in this queue.org.apache.hadoop.yarn.api.records.ResourcegetComputedResourceLimitForAllUsers(String userName, org.apache.hadoop.yarn.api.records.Resource clusterResource, String nodePartition, SchedulingMode schedulingMode) Get computed user-limit for all users in this queue.protected longintGet number of active users i.e. users with applications which have pending resource requests.intfloatgetUsageRatio(String label) Get user object for given user name.getUserAndAddIfAbsent(String userName) Get and add user if absent.floatGet configured user-limit.floatGet configured user-limit factor.getUsers()voidremoveUser(String userName) Remove user.voidsetUserLimit(float userLimit) Set configured user-limit.voidsetUserLimitFactor(float userLimitFactor) Set configured user-limit factor.voidupdateUsageRatio(String partition, org.apache.hadoop.yarn.api.records.Resource clusterResource) Update new usage ratio.updateUserResourceUsage(String userName, org.apache.hadoop.yarn.api.records.Resource resource, org.apache.hadoop.yarn.api.records.Resource clusterResource, String nodePartition, boolean isAllocate) During container allocate/release, ensure that all user specific data structures are updated.voidvoidForce UsersManager to recompute userlimit.
-
Constructor Details
-
UsersManager
public UsersManager(QueueMetrics metrics, AbstractLeafQueue lQueue, RMNodeLabelsManager labelManager, org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator) UsersManager Constructor.- Parameters:
metrics- Queue MetricslQueue- Leaf Queue ObjectlabelManager- Label Manager instanceresourceCalculator- rc
-
-
Method Details
-
getUserLimit
public float getUserLimit()Get configured user-limit.- Returns:
- user limit
-
setUserLimit
public void setUserLimit(float userLimit) Set configured user-limit.- Parameters:
userLimit- user limit
-
getUserLimitFactor
public float getUserLimitFactor()Get configured user-limit factor.- Returns:
- user-limit factor
-
setUserLimitFactor
public void setUserLimitFactor(float userLimitFactor) Set configured user-limit factor.- Parameters:
userLimitFactor- User Limit factor.
-
getUsageRatio
-
userLimitNeedsRecompute
public void userLimitNeedsRecompute()Force UsersManager to recompute userlimit. -
getUsers
-
getUser
Get user object for given user name.- Parameters:
userName- User Name- Returns:
- User object
-
removeUser
Remove user.- Parameters:
userName- User Name
-
getUserAndAddIfAbsent
Get and add user if absent.- Parameters:
userName- User Name- Returns:
- User object
-
getUsersInfo
- Returns:
- an ArrayList of UserInfo objects who are active in this queue
-
getComputedResourceLimitForActiveUsers
public org.apache.hadoop.yarn.api.records.Resource getComputedResourceLimitForActiveUsers(String userName, org.apache.hadoop.yarn.api.records.Resource clusterResource, String nodePartition, SchedulingMode schedulingMode) Get computed user-limit for all ACTIVE users in this queue. If cached data is invalidated due to resource change, this method also enforce to recompute user-limit.- Parameters:
userName- Name of user who has submitted one/more app to given queue.clusterResource- total cluster resourcenodePartition- partition nameschedulingMode- scheduling mode RESPECT_PARTITION_EXCLUSIVITY/IGNORE_PARTITION_EXCLUSIVITY- Returns:
- Computed User Limit
-
getComputedResourceLimitForAllUsers
public org.apache.hadoop.yarn.api.records.Resource getComputedResourceLimitForAllUsers(String userName, org.apache.hadoop.yarn.api.records.Resource clusterResource, String nodePartition, SchedulingMode schedulingMode) Get computed user-limit for all users in this queue. If cached data is invalidated due to resource change, this method also enforce to recompute user-limit.- Parameters:
userName- Name of user who has submitted one/more app to given queue.clusterResource- total cluster resourcenodePartition- partition nameschedulingMode- scheduling mode RESPECT_PARTITION_EXCLUSIVITY/IGNORE_PARTITION_EXCLUSIVITY- Returns:
- Computed User Limit
-
getLatestVersionOfUsersState
protected long getLatestVersionOfUsersState() -
updateUsageRatio
public void updateUsageRatio(String partition, org.apache.hadoop.yarn.api.records.Resource clusterResource) Update new usage ratio.- Parameters:
partition- Node partitionclusterResource- cluster resource
-
activateApplication
public void activateApplication(String user, org.apache.hadoop.yarn.api.records.ApplicationId applicationId) Description copied from interface:AbstractUsersManagerAn application has new outstanding requests.- Specified by:
activateApplicationin interfaceAbstractUsersManager- Parameters:
user- application userapplicationId- activated application
-
deactivateApplication
public void deactivateApplication(String user, org.apache.hadoop.yarn.api.records.ApplicationId applicationId) Description copied from interface:AbstractUsersManagerAn application has no more outstanding requests.- Specified by:
deactivateApplicationin interfaceAbstractUsersManager- Parameters:
user- application userapplicationId- deactivated application
-
getNumActiveUsers
public int getNumActiveUsers()Description copied from interface:AbstractUsersManagerGet number of active users i.e. users with applications which have pending resource requests.- Specified by:
getNumActiveUsersin interfaceAbstractUsersManager- Returns:
- number of active users
-
updateUserResourceUsage
public UsersManager.User updateUserResourceUsage(String userName, org.apache.hadoop.yarn.api.records.Resource resource, org.apache.hadoop.yarn.api.records.Resource clusterResource, String nodePartition, boolean isAllocate) During container allocate/release, ensure that all user specific data structures are updated.- Parameters:
userName- Name of the userresource- Resource to increment/decrementclusterResource- Cluster resource (for testing purposes only)nodePartition- Node labelisAllocate- Indicate whether to allocate or release resource- Returns:
- user
-
updateUserWeights
public void updateUserWeights() -
getNumActiveUsersWithOnlyPendingApps
@VisibleForTesting public int getNumActiveUsersWithOnlyPendingApps()
-