slfan1989 commented on code in PR #4695:
URL: https://github.com/apache/hadoop/pull/4695#discussion_r937313558
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java:
##########
@@ -1377,7 +1400,35 @@ public RMQueueAclInfo checkUserAccessToQueue(String
queue, String username,
@Override
public AppAttemptInfo getAppAttempt(HttpServletRequest req,
HttpServletResponse res, String appId, String appAttemptId) {
- throw new NotImplementedException("Code is not implemented");
+
+ if (appId == null || appId.isEmpty()) {
+ throw new IllegalArgumentException("Parameter error, the appId is empty
or null.");
+ }
+ if (appAttemptId == null || appAttemptId.isEmpty()) {
+ throw new IllegalArgumentException("Parameter error, the appAttemptId is
empty or null.");
+ }
+
+ try {
+ ApplicationId applicationId = ApplicationId.fromString(appId);
+ SubClusterInfo subClusterInfo =
getHomeSubClusterInfoByAppId(applicationId);
+
+ if (subClusterInfo == null) {
+ RouterServerUtil.logAndThrowRunTimeException("Unable to get subCluster
by applicationId = "
+ + applicationId, null);
+ }
+
+ DefaultRequestInterceptorREST interceptor =
getOrCreateInterceptorForSubCluster(
+ subClusterInfo.getSubClusterId(),
subClusterInfo.getRMWebServiceAddress());
+ return interceptor.getAppAttempt(req, res, appId, appAttemptId);
+ } catch (IllegalArgumentException e) {
+ String msg = String.format("Unable to get the AppAttempt appId: %s,
appAttemptId: %s.",
+ appId, appAttemptId);
+ RouterServerUtil.logAndThrowRunTimeException(msg, e);
Review Comment:
This is a good idea, I will modify the code.
--
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]