Package org.apache.hadoop.yarn.client
Class AMRMClientUtils
java.lang.Object
org.apache.hadoop.yarn.client.AMRMClientUtils
Utility class for AMRMClient.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddToOutstandingSchedulingRequests(Collection<org.apache.hadoop.yarn.api.records.SchedulingRequest> requests, Map<Set<String>, List<org.apache.hadoop.yarn.api.records.SchedulingRequest>> outstandingSchedRequests) static StringassembleInvalidResponseIdExceptionMessage(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, int expected, int received) Generate the exception message when RM receives an AM heartbeat with invalid responseId.static <T> TcreateRMProxy(org.apache.hadoop.conf.Configuration configuration, Class<T> protocol, org.apache.hadoop.security.UserGroupInformation user, org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier> token) Create a proxy for the specified protocol.static intgetNextResponseId(int responseId) static booleanisMatchingSchedulingRequests(org.apache.hadoop.yarn.api.records.SchedulingRequest schedReq1, org.apache.hadoop.yarn.api.records.SchedulingRequest schedReq2) static intparseExpectedResponseIdFromException(String exceptionMessage) Parse the expected responseId from the exception generated by RM when processing AM heartbeat.static voidremoveFromOutstandingSchedulingRequests(Collection<org.apache.hadoop.yarn.api.records.Container> containers, Map<Set<String>, List<org.apache.hadoop.yarn.api.records.SchedulingRequest>> outstandingSchedRequests)
-
Field Details
-
PRE_REGISTER_RESPONSE_ID
public static final int PRE_REGISTER_RESPONSE_ID- See Also:
-
APP_ALREADY_REGISTERED_MESSAGE
- See Also:
-
EXPECTED_HB_RESPONSEID_MESSAGE
- See Also:
-
RECEIVED_HB_RESPONSEID_MESSAGE
- See Also:
-
-
Method Details
-
createRMProxy
@Public @Unstable public static <T> T createRMProxy(org.apache.hadoop.conf.Configuration configuration, Class<T> protocol, org.apache.hadoop.security.UserGroupInformation user, org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier> token) throws IOException Create a proxy for the specified protocol.- Type Parameters:
T- Type information of the proxy- Parameters:
configuration- Configuration to generateClientRMProxyprotocol- Protocol for the proxyuser- the user on whose behalf the proxy is being createdtoken- the auth token to use for connection- Returns:
- Proxy to the RM
- Throws:
IOException- on failure
-
assembleInvalidResponseIdExceptionMessage
public static String assembleInvalidResponseIdExceptionMessage(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, int expected, int received) Generate the exception message when RM receives an AM heartbeat with invalid responseId.- Parameters:
appAttemptId- the app attemptexpected- the expected responseId valuereceived- the received responseId value- Returns:
- the assembled exception message
-
parseExpectedResponseIdFromException
Parse the expected responseId from the exception generated by RM when processing AM heartbeat.- Parameters:
exceptionMessage- the exception message thrown by RM- Returns:
- the parsed expected responseId, -1 if failed
-
getNextResponseId
public static int getNextResponseId(int responseId) -
addToOutstandingSchedulingRequests
public static void addToOutstandingSchedulingRequests(Collection<org.apache.hadoop.yarn.api.records.SchedulingRequest> requests, Map<Set<String>, List<org.apache.hadoop.yarn.api.records.SchedulingRequest>> outstandingSchedRequests) -
isMatchingSchedulingRequests
public static boolean isMatchingSchedulingRequests(org.apache.hadoop.yarn.api.records.SchedulingRequest schedReq1, org.apache.hadoop.yarn.api.records.SchedulingRequest schedReq2) -
removeFromOutstandingSchedulingRequests
public static void removeFromOutstandingSchedulingRequests(Collection<org.apache.hadoop.yarn.api.records.Container> containers, Map<Set<String>, List<org.apache.hadoop.yarn.api.records.SchedulingRequest>> outstandingSchedRequests)
-