@InterfaceAudience.Private public class UsersManager extends Object implements AbstractUsersManager
UsersManager
tracks users in the system and its respective data
structures.Modifier and Type | Class and Description |
---|---|
static class |
UsersManager.User
User class stores all user related resource usage, application details.
|
Constructor and Description |
---|
UsersManager(QueueMetrics metrics,
LeafQueue lQueue,
RMNodeLabelsManager labelManager,
CapacitySchedulerContext scheduler,
org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator)
UsersManager Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
activateApplication(String user,
org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
An application has new outstanding requests.
|
void |
deactivateApplication(String user,
org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
An application has no more outstanding requests.
|
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.
|
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.
|
protected long |
getLatestVersionOfUsersState() |
int |
getNumActiveUsers()
Get number of active users i.e.
|
int |
getNumActiveUsersWithOnlyPendingApps() |
float |
getUsageRatio(String label) |
UsersManager.User |
getUser(String userName)
Get user object for given user name.
|
UsersManager.User |
getUserAndAddIfAbsent(String userName)
Get and add user if absent.
|
int |
getUserLimit()
Get configured user-limit.
|
float |
getUserLimitFactor()
Get configured user-limit factor.
|
Map<String,UsersManager.User> |
getUsers() |
ArrayList<UserInfo> |
getUsersInfo() |
void |
removeUser(String userName)
Remove user.
|
void |
setUserLimit(int userLimit)
Set configured user-limit.
|
void |
setUserLimitFactor(float userLimitFactor)
Set configured user-limit factor.
|
void |
updateUsageRatio(String partition,
org.apache.hadoop.yarn.api.records.Resource clusterResource)
Update new usage ratio.
|
UsersManager.User |
updateUserResourceUsage(String userName,
org.apache.hadoop.yarn.api.records.Resource resource,
String nodePartition,
boolean isAllocate)
During container allocate/release, ensure that all user specific data
structures are updated.
|
void |
updateUserWeights() |
void |
userLimitNeedsRecompute()
Force UsersManager to recompute userlimit.
|
public UsersManager(QueueMetrics metrics, LeafQueue lQueue, RMNodeLabelsManager labelManager, CapacitySchedulerContext scheduler, org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator)
metrics
- Queue MetricslQueue
- Leaf Queue ObjectlabelManager
- Label Manager instancescheduler
- Capacity Scheduler ContextresourceCalculator
- rcpublic int getUserLimit()
public void setUserLimit(int userLimit)
userLimit
- user limitpublic float getUserLimitFactor()
public void setUserLimitFactor(float userLimitFactor)
userLimitFactor
- User Limit factor.public float getUsageRatio(String label)
public void userLimitNeedsRecompute()
public Map<String,UsersManager.User> getUsers()
public UsersManager.User getUser(String userName)
userName
- User Namepublic void removeUser(String userName)
userName
- User Namepublic UsersManager.User getUserAndAddIfAbsent(String userName)
userName
- User Namepublic ArrayList<UserInfo> getUsersInfo()
public org.apache.hadoop.yarn.api.records.Resource getComputedResourceLimitForActiveUsers(String userName, org.apache.hadoop.yarn.api.records.Resource clusterResource, String nodePartition, SchedulingMode schedulingMode)
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_EXCLUSIVITYpublic org.apache.hadoop.yarn.api.records.Resource getComputedResourceLimitForAllUsers(String userName, org.apache.hadoop.yarn.api.records.Resource clusterResource, String nodePartition, SchedulingMode schedulingMode)
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_EXCLUSIVITYprotected long getLatestVersionOfUsersState()
public void updateUsageRatio(String partition, org.apache.hadoop.yarn.api.records.Resource clusterResource)
partition
- Node partitionclusterResource
- Cluster Resourcepublic void activateApplication(String user, org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
AbstractUsersManager
activateApplication
in interface AbstractUsersManager
user
- application userapplicationId
- activated applicationpublic void deactivateApplication(String user, org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
AbstractUsersManager
deactivateApplication
in interface AbstractUsersManager
user
- application userapplicationId
- deactivated applicationpublic int getNumActiveUsers()
AbstractUsersManager
getNumActiveUsers
in interface AbstractUsersManager
public UsersManager.User updateUserResourceUsage(String userName, org.apache.hadoop.yarn.api.records.Resource resource, String nodePartition, boolean isAllocate)
userName
- Name of the userresource
- Resource to increment/decrementnodePartition
- Node labelisAllocate
- Indicate whether to allocate or release resourcepublic void updateUserWeights()
public int getNumActiveUsersWithOnlyPendingApps()
Copyright © 2008–2022 Apache Software Foundation. All rights reserved.