goiri commented on code in PR #4396:
URL: https://github.com/apache/hadoop/pull/4396#discussion_r889223330
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/clientrm/FederationClientInterceptor.java:
##########
@@ -1213,14 +1213,97 @@ public CancelDelegationTokenResponse
cancelDelegationToken(
@Override
public FailApplicationAttemptResponse failApplicationAttempt(
FailApplicationAttemptRequest request) throws YarnException, IOException
{
- throw new NotImplementedException("Code is not implemented");
+ if (request == null || request.getApplicationAttemptId() == null
+ || request.getApplicationAttemptId().getApplicationId() == null) {
+ routerMetrics.incrFailAppAttemptFailedRetrieved();
+ RouterServerUtil.logAndThrowException(
+ "Missing failApplicationAttempt request or applicationId " +
+ "or applicationAttemptId information.", null);
+ }
+ long startTime = clock.getTime();
+ SubClusterId subClusterId = null;
+ ApplicationId applicationId =
request.getApplicationAttemptId().getApplicationId();
+
+ try {
+ subClusterId = getApplicationHomeSubCluster(applicationId);
+ } catch (YarnException e) {
+ routerMetrics.incrFailAppAttemptFailedRetrieved();
+ RouterServerUtil.logAndThrowException("ApplicationAttempt " +
+ request.getApplicationAttemptId() + " belongs to Application " +
+ request.getApplicationAttemptId().getApplicationId() +
+ " does not exist in FederationStateStore.", e);
+ }
+
+ ApplicationClientProtocol clientRMProxy =
getClientRMProxyForSubCluster(subClusterId);
+ FailApplicationAttemptResponse response;
+ try {
+ response = clientRMProxy.failApplicationAttempt(request);
+ } catch (Exception e) {
+ routerMetrics.incrFailAppAttemptFailedRetrieved();
+ LOG.error("Unable to get the applicationAttempt report for {} " +
+ "to SubCluster {}.",
+ request.getApplicationAttemptId(), subClusterId.getId(), e);
+ throw e;
+ }
+
+ if (response == null) {
+ LOG.error("No response when attempting to retrieve the report of " +
+ "the applicationAttempt {} to SubCluster {}.",
+ request.getApplicationAttemptId(), subClusterId.getId());
+ }
+
+ long stopTime = clock.getTime();
+ routerMetrics.succeededFailAppAttemptRetrieved(stopTime - startTime);
+ return response;
}
@Override
public UpdateApplicationPriorityResponse updateApplicationPriority(
UpdateApplicationPriorityRequest request)
throws YarnException, IOException {
- throw new NotImplementedException("Code is not implemented");
+ if (request == null || request.getApplicationId() == null
+ || request.getApplicationPriority() == null) {
+ routerMetrics.incrUpdateAppPriorityFailedRetrieved();
+ RouterServerUtil.logAndThrowException(
+ "Missing updateApplicationPriority request or applicationId " +
+ "or applicationPriority information.", null);
+ }
+
+ long startTime = clock.getTime();
+ SubClusterId subClusterId = null;
+ ApplicationId applicationId = request.getApplicationId();
+
+ try {
+ subClusterId = getApplicationHomeSubCluster(applicationId);
+ } catch (YarnException e) {
+ routerMetrics.incrUpdateAppPriorityFailedRetrieved();
+ RouterServerUtil.logAndThrowException("Application " +
+ request.getApplicationId() +
+ " does not exist in FederationStateStore.", e);
+ }
+
+ ApplicationClientProtocol clientRMProxy =
getClientRMProxyForSubCluster(subClusterId);
+
+ UpdateApplicationPriorityResponse response;
+ try {
+ response = clientRMProxy.updateApplicationPriority(request);
+ } catch (Exception e) {
+ routerMetrics.incrFailAppAttemptFailedRetrieved();
+ LOG.error("Unable to update application priority for {} " +
+ "to SubCluster {}.",
+ request.getApplicationId(), subClusterId.getId(), e);
+ throw e;
Review Comment:
logAndThrowException()?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]