Class RouterServerUtil
java.lang.Object
org.apache.hadoop.yarn.server.router.RouterServerUtil
Common utility methods used by the Router server.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckAppSubmissionContext(org.apache.hadoop.yarn.api.records.impl.pb.ApplicationSubmissionContextPBImpl appContext, org.apache.hadoop.conf.Configuration conf) Checks if the ApplicationSubmissionContext submitted with the application is valid.static booleancheckPolicyManagerValid(String policyManager, List<String> supportWeightList) static org.apache.hadoop.yarn.api.records.ReservationDefinitionconvertReservationDefinition(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationDefinitionInfo definitionInfo) Convert ReservationDefinitionInfo to ReservationDefinition.static <R> RcreateRequestInterceptorChain(org.apache.hadoop.conf.Configuration conf, String pipeLineClassName, String interceptorClassName, Class<R> clazz) static StringgetRenewerForToken(org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier> token) static org.apache.hadoop.yarn.api.records.ApplicationSubmissionContextgetTrimmedAppSubmissionContext(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext actualContext) Get trimmed version of ApplicationSubmissionContext to be saved to Federation State Store.static booleanstatic booleanisRouterWebProxyEnable(org.apache.hadoop.conf.Configuration conf) static RuntimeExceptionlogAndReturnRunTimeException(String errMsgFormat, Object... args) Throws an RunTimeException due to an error.static RuntimeExceptionlogAndReturnRunTimeException(Throwable t, String errMsgFormat, Object... args) Throws an RunTimeException due to an error.static org.apache.hadoop.yarn.exceptions.YarnRuntimeExceptionlogAndReturnYarnRunTimeException(Throwable t, String errMsgFormat, Object... args) Throws an YarnRuntimeException due to an error.static voidlogAndThrowException(String errMsg) Throws an exception due to an error.static voidlogAndThrowException(String errMsg, Throwable t) Throws an exception due to an error.static voidlogAndThrowException(Throwable t, String errMsgFormat, Object... args) Throws an exception due to an error.static voidlogAndThrowIOException(String errMsg, Throwable t) Throws an IOException due to an error.static voidlogAndThrowIOException(Throwable t, String errMsgFormat, Object... args) Throws an IOException due to an error.static voidlogAndThrowRunTimeException(String errMsg, Throwable t) Throws an RunTimeException due to an error.static voidlogAndThrowRunTimeException(Throwable t, String errMsgFormat, Object... args) Throws an RunTimeException due to an error.static org.apache.hadoop.security.UserGroupInformationSet User information.static voidvalidateApplicationAttemptId(String appAttemptId) Check appAttemptId is accurate.static voidvalidateApplicationId(String applicationId) Check applicationId is accurate.static voidvalidateContainerId(String containerId) Check containerId is accurate.static voidvalidateReservationId(String reservationId) Check reservationId is accurate.
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Method Details
-
logAndThrowException
@Public @Unstable public static void logAndThrowException(Throwable t, String errMsgFormat, Object... args) throws org.apache.hadoop.yarn.exceptions.YarnException Throws an exception due to an error.- Parameters:
t- the throwable raised in the called class.errMsgFormat- the error message format string.args- referenced by the format specifiers in the format string.- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- on failure
-
logAndThrowException
@Public @Unstable public static void logAndThrowException(String errMsg, Throwable t) throws org.apache.hadoop.yarn.exceptions.YarnException Throws an exception due to an error.- Parameters:
errMsg- the error messaget- the throwable raised in the called class.- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- on failure
-
logAndThrowException
@Public @Unstable public static void logAndThrowException(String errMsg) throws org.apache.hadoop.yarn.exceptions.YarnException Throws an exception due to an error.- Parameters:
errMsg- the error message- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- on failure
-
createRequestInterceptorChain
-
logAndThrowIOException
@Public @Unstable public static void logAndThrowIOException(String errMsg, Throwable t) throws IOException Throws an IOException due to an error.- Parameters:
errMsg- the error messaget- the throwable raised in the called class.- Throws:
IOException- on failure
-
logAndThrowIOException
@Public @Unstable public static void logAndThrowIOException(Throwable t, String errMsgFormat, Object... args) throws IOException Throws an IOException due to an error.- Parameters:
t- the throwable raised in the called class.errMsgFormat- the error message format string.args- referenced by the format specifiers in the format string.- Throws:
IOException- on failure
-
logAndThrowRunTimeException
@Public @Unstable public static void logAndThrowRunTimeException(String errMsg, Throwable t) throws RuntimeException Throws an RunTimeException due to an error.- Parameters:
errMsg- the error messaget- the throwable raised in the called class.- Throws:
RuntimeException- on failure
-
logAndThrowRunTimeException
@Public @Unstable public static void logAndThrowRunTimeException(Throwable t, String errMsgFormat, Object... args) throws RuntimeException Throws an RunTimeException due to an error.- Parameters:
t- the throwable raised in the called class.errMsgFormat- the error message format string.args- referenced by the format specifiers in the format string.- Throws:
RuntimeException- on failure
-
logAndReturnRunTimeException
@Public @Unstable public static RuntimeException logAndReturnRunTimeException(Throwable t, String errMsgFormat, Object... args) Throws an RunTimeException due to an error.- Parameters:
t- the throwable raised in the called class.errMsgFormat- the error message format string.args- referenced by the format specifiers in the format string.- Returns:
- RuntimeException
-
logAndReturnRunTimeException
@Public @Unstable public static RuntimeException logAndReturnRunTimeException(String errMsgFormat, Object... args) Throws an RunTimeException due to an error.- Parameters:
errMsgFormat- the error message format string.args- referenced by the format specifiers in the format string.- Returns:
- RuntimeException
-
logAndReturnYarnRunTimeException
@Public @Unstable public static org.apache.hadoop.yarn.exceptions.YarnRuntimeException logAndReturnYarnRunTimeException(Throwable t, String errMsgFormat, Object... args) Throws an YarnRuntimeException due to an error.- Parameters:
t- the throwable raised in the called class.errMsgFormat- the error message format string.args- referenced by the format specifiers in the format string.- Returns:
- YarnRuntimeException
-
validateApplicationId
@Public @Unstable public static void validateApplicationId(String applicationId) throws IllegalArgumentException Check applicationId is accurate. We need to ensure that applicationId cannot be empty and can be converted to ApplicationId object normally.- Parameters:
applicationId- applicationId of type string- Throws:
IllegalArgumentException- If the format of the applicationId is not accurate, an IllegalArgumentException needs to be thrown.
-
validateApplicationAttemptId
@Public @Unstable public static void validateApplicationAttemptId(String appAttemptId) throws IllegalArgumentException Check appAttemptId is accurate. We need to ensure that appAttemptId cannot be empty and can be converted to ApplicationAttemptId object normally.- Parameters:
appAttemptId- appAttemptId of type string.- Throws:
IllegalArgumentException- If the format of the appAttemptId is not accurate, an IllegalArgumentException needs to be thrown.
-
validateContainerId
@Public @Unstable public static void validateContainerId(String containerId) throws IllegalArgumentException Check containerId is accurate. We need to ensure that containerId cannot be empty and can be converted to ContainerId object normally.- Parameters:
containerId- containerId of type string.- Throws:
IllegalArgumentException- If the format of the appAttemptId is not accurate, an IllegalArgumentException needs to be thrown.
-
isAllowedDelegationTokenOp
- Throws:
IOException
-
getRenewerForToken
public static String getRenewerForToken(org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier> token) throws IOException - Throws:
IOException
-
setupUser
Set User information. If the username is empty, we will use the Yarn Router user directly. Do not create a proxy user if userName matches the userName on current UGI.- Parameters:
userName- userName.- Returns:
- UserGroupInformation.
-
validateReservationId
@Public @Unstable public static void validateReservationId(String reservationId) throws IllegalArgumentException Check reservationId is accurate. We need to ensure that reservationId cannot be empty and can be converted to ReservationId object normally.- Parameters:
reservationId- reservationId.- Throws:
IllegalArgumentException- If the format of the reservationId is not accurate, an IllegalArgumentException needs to be thrown.
-
convertReservationDefinition
public static org.apache.hadoop.yarn.api.records.ReservationDefinition convertReservationDefinition(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationDefinitionInfo definitionInfo) Convert ReservationDefinitionInfo to ReservationDefinition.- Parameters:
definitionInfo- ReservationDefinitionInfo Object.- Returns:
- ReservationDefinition.
-
checkAppSubmissionContext
@Public @Unstable public static void checkAppSubmissionContext(org.apache.hadoop.yarn.api.records.impl.pb.ApplicationSubmissionContextPBImpl appContext, org.apache.hadoop.conf.Configuration conf) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException Checks if the ApplicationSubmissionContext submitted with the application is valid. Current checks: - if its size is within limits.- Parameters:
appContext- the app context to check.conf- Configuration.- Throws:
IOException- if an IO error occurred.org.apache.hadoop.yarn.exceptions.YarnException- yarn exception.
-
getTrimmedAppSubmissionContext
@Private @Unstable public static org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getTrimmedAppSubmissionContext(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext actualContext) Get trimmed version of ApplicationSubmissionContext to be saved to Federation State Store.- Parameters:
actualContext- actual ApplicationSubmissionContext.- Returns:
- trimmed ApplicationSubmissionContext.
-
isRouterWebProxyEnable
public static boolean isRouterWebProxyEnable(org.apache.hadoop.conf.Configuration conf) -
checkPolicyManagerValid
public static boolean checkPolicyManagerValid(String policyManager, List<String> supportWeightList) throws org.apache.hadoop.yarn.exceptions.YarnException - Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-