public class RMServerUtils extends Object
| Modifier and Type | Field and Description | 
|---|---|
| static org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport | DUMMY_APPLICATION_RESOURCE_USAGE_REPORTStatically defined dummy ApplicationResourceUsageREport. | 
| protected static org.apache.hadoop.yarn.factories.RecordFactory | RECORD_FACTORY | 
| static String | RESOURCE_OUTSIDE_ALLOWED_RANGE | 
| static String | UPDATE_OUTSTANDING_ERROR | 
| Constructor and Description | 
|---|
| RMServerUtils() | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | checkSchedContainerChangeRequest(SchedContainerChangeRequest request,
                                boolean increase)Validate increase/decrease request. | 
| static org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState | convertRmAppAttemptStateToYarnApplicationAttemptState(RMAppAttemptState currentState,
                                                     RMAppAttemptState previousState) | 
| static org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState | createApplicationAttemptState(RMAppAttemptState rmAppAttemptState) | 
| static org.apache.hadoop.yarn.api.records.YarnApplicationState | createApplicationState(RMAppState rmAppState) | 
| static int | getApplicableNodeCountForAM(RMContext rmContext,
                           org.apache.hadoop.conf.Configuration conf,
                           List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs)Get applicable Node count for AM. | 
| static Long | getOrDefault(Map<String,Long> map,
            String key,
            Long defaultValue) | 
| static void | normalizeAndValidateRequests(List<org.apache.hadoop.yarn.api.records.ResourceRequest> ask,
                            org.apache.hadoop.yarn.api.records.Resource maximumAllocation,
                            String queueName,
                            YarnScheduler scheduler,
                            RMContext rmContext,
                            boolean nodeLabelsEnabled)Utility method to validate a list resource requests, by ensuring that the
 requested memory/vcore is non-negative and not greater than max. | 
| static void | processRMProxyUsersConf(org.apache.hadoop.conf.Configuration conf)Find all configs whose name starts with
 YarnConfiguration.RM_PROXY_USER_PREFIX, and add a record for each one by
 replacing the prefix with ProxyUsers.CONF_HADOOP_PROXYUSER. | 
| static List<RMNode> | queryRMNodes(RMContext context,
            EnumSet<org.apache.hadoop.yarn.api.records.NodeState> acceptedStates) | 
| static ContainerUpdates | validateAndSplitUpdateResourceRequests(RMContext rmContext,
                                      org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest request,
                                      org.apache.hadoop.yarn.api.records.Resource maximumAllocation,
                                      List<org.apache.hadoop.yarn.api.records.UpdateContainerError> updateErrors)Check if we have:
 - Request for same containerId and different target resource. | 
| static void | validateApplicationTimeouts(Map<org.apache.hadoop.yarn.api.records.ApplicationTimeoutType,Long> timeouts) | 
| static void | validateBlacklistRequest(org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest blacklistRequest) | 
| static void | validateContainerReleaseRequest(List<org.apache.hadoop.yarn.api.records.ContainerId> containerReleaseList,
                               org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)It will validate to make sure all the containers belong to correct
 application attempt id. | 
| static Map<org.apache.hadoop.yarn.api.records.ApplicationTimeoutType,Long> | validateISO8601AndConvertToLocalTimeEpoch(Map<org.apache.hadoop.yarn.api.records.ApplicationTimeoutType,String> timeoutsInISO8601)Validate ISO8601 format with epoch time. | 
| static org.apache.hadoop.security.UserGroupInformation | verifyAdminAccess(org.apache.hadoop.yarn.security.YarnAuthorizationProvider authorizer,
                 String method,
                 org.slf4j.Logger LOG) | 
| static org.apache.hadoop.security.UserGroupInformation | verifyAdminAccess(org.apache.hadoop.yarn.security.YarnAuthorizationProvider authorizer,
                 String method,
                 String module,
                 org.slf4j.Logger LOG)Utility method to verify if the current user has access based on the
 passed  AccessControlList | 
public static final String UPDATE_OUTSTANDING_ERROR
public static final String RESOURCE_OUTSIDE_ALLOWED_RANGE
protected static final org.apache.hadoop.yarn.factories.RecordFactory RECORD_FACTORY
public static final org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport DUMMY_APPLICATION_RESOURCE_USAGE_REPORT
public static List<RMNode> queryRMNodes(RMContext context, EnumSet<org.apache.hadoop.yarn.api.records.NodeState> acceptedStates)
public static ContainerUpdates validateAndSplitUpdateResourceRequests(RMContext rmContext, org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest request, org.apache.hadoop.yarn.api.records.Resource maximumAllocation, List<org.apache.hadoop.yarn.api.records.UpdateContainerError> updateErrors)
rmContext - RM context.request - Allocate Request.maximumAllocation - Maximum Allocation.updateErrors - Container update errors.public static void normalizeAndValidateRequests(List<org.apache.hadoop.yarn.api.records.ResourceRequest> ask, org.apache.hadoop.yarn.api.records.Resource maximumAllocation, String queueName, YarnScheduler scheduler, RMContext rmContext, boolean nodeLabelsEnabled) throws org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException
ask - resource request.maximumAllocation - Maximum Allocation.queueName - queue name.scheduler - YarnScheduler.rmContext - RMContext.nodeLabelsEnabled - the node labels feature enabled.org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException - when there is invalid request.public static void checkSchedContainerChangeRequest(SchedContainerChangeRequest request, boolean increase) throws org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException
- Throw exception when any other error happens
request - SchedContainerChangeRequest.increase - true, add container; false, decrease container.org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException - when there is invalid request.public static void validateBlacklistRequest(org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest blacklistRequest)
                                     throws org.apache.hadoop.yarn.exceptions.InvalidResourceBlacklistRequestException
org.apache.hadoop.yarn.exceptions.InvalidResourceBlacklistRequestExceptionpublic static void validateContainerReleaseRequest(List<org.apache.hadoop.yarn.api.records.ContainerId> containerReleaseList, org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) throws org.apache.hadoop.yarn.exceptions.InvalidContainerReleaseException
InvalidContainerReleaseExceptioncontainerReleaseList - containers to be released as requested by
                             application master.appAttemptId - Application attempt Idorg.apache.hadoop.yarn.exceptions.InvalidContainerReleaseException - an Application Master tries to release containers not belonging to it using.public static org.apache.hadoop.security.UserGroupInformation verifyAdminAccess(org.apache.hadoop.yarn.security.YarnAuthorizationProvider authorizer,
                                                                                String method,
                                                                                org.slf4j.Logger LOG)
                                                                         throws IOException
IOExceptionpublic static org.apache.hadoop.security.UserGroupInformation verifyAdminAccess(org.apache.hadoop.yarn.security.YarnAuthorizationProvider authorizer,
                                                                                String method,
                                                                                String module,
                                                                                org.slf4j.Logger LOG)
                                                                         throws IOException
AccessControlListauthorizer - the AccessControlList to check againstmethod - the method name to be loggedmodule - like AdminService or NodeLabelManagerLOG - the logger to useUserGroupInformation of the current userIOException - an I/O exception has occurred.public static org.apache.hadoop.yarn.api.records.YarnApplicationState createApplicationState(RMAppState rmAppState)
public static org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState convertRmAppAttemptStateToYarnApplicationAttemptState(RMAppAttemptState currentState, RMAppAttemptState previousState)
public static org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState createApplicationAttemptState(RMAppAttemptState rmAppAttemptState)
public static void processRMProxyUsersConf(org.apache.hadoop.conf.Configuration conf)
conf - Configuration.public static void validateApplicationTimeouts(Map<org.apache.hadoop.yarn.api.records.ApplicationTimeoutType,Long> timeouts) throws org.apache.hadoop.yarn.exceptions.YarnException
org.apache.hadoop.yarn.exceptions.YarnExceptionpublic static Map<org.apache.hadoop.yarn.api.records.ApplicationTimeoutType,Long> validateISO8601AndConvertToLocalTimeEpoch(Map<org.apache.hadoop.yarn.api.records.ApplicationTimeoutType,String> timeoutsInISO8601) throws org.apache.hadoop.yarn.exceptions.YarnException
timeoutsInISO8601 - formatorg.apache.hadoop.yarn.exceptions.YarnException - if given application timeout value is lesser than
           current time.public static int getApplicableNodeCountForAM(RMContext rmContext, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.yarn.api.records.ResourceRequest> amReqs)
rmContext - contextconf - configurationamReqs - am resource requestsCopyright © 2008–2025 Apache Software Foundation. All rights reserved.