-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YARN-11228. [Federation] Add getAppAttempts, getAppAttempt REST APIs for Router. #4695
Conversation
|
||
try { | ||
ApplicationId applicationId = ApplicationId.fromString(appId); | ||
SubClusterInfo subClusterInfo = getHomeSubClusterInfoByAppId(applicationId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should've proposed this before but we keep doing this string to ApplicationId.
We could just have this getHomeSubClusterInfoByAppId() to take a string and do the transformation there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion, I will modify the code.
@@ -412,4 +419,50 @@ public Response signalToContainer(String containerId, String command, | |||
|
|||
return Response.status(Status.OK).build(); | |||
} | |||
|
|||
@Override | |||
public org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo getAppAttempt(HttpServletRequest req, HttpServletResponse res, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to specify the whole type? Where is the conflict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found 2 conflicts
org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppAttemptInfo
org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo
The way to resolve the conflict, I will create the method in other classes(TestRouterWebServiceUtil#generateAppAttemptInfo)
} catch (IllegalArgumentException e) { | ||
String msg = String.format("Unable to get the AppAttempt appId: %s, appAttemptId: %s.", | ||
appId, appAttemptId); | ||
RouterServerUtil.logAndThrowRunTimeException(msg, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we create a logAndThrowRunTimeException that already does the format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea, I will modify the code.
|
||
AppAttemptsInfo appAttemptsInfo = interceptor.getAppAttempts(null, appId.toString()); | ||
Assert.assertNotNull(appAttemptsInfo); | ||
Assert.assertTrue(!appAttemptsInfo.getAttempts().isEmpty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check before the submission too?
It would be nice to check something more specific than not empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion is right, this part needs to be refactored, I will fix it.
ApplicationSubmissionContextInfo context = new ApplicationSubmissionContextInfo(); | ||
context.setApplicationId(appId.toString()); | ||
Assert.assertNotNull(interceptor.submitApplication(context, null)); | ||
ApplicationAttemptId appAttemptIdExcept = ApplicationAttemptId.newInstance(appId, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except? Expect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably create the appId and attemptId one after the other.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@@ -52,7 +74,7 @@ private RouterServerUtil() { | |||
@Public | |||
@Unstable | |||
public static void logAndThrowException(String errMsg, Throwable t) | |||
throws YarnException { | |||
throws YarnException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old indentation was correct, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your help reviewing the code, I will fix it.
*/ | ||
@Public | ||
@Unstable | ||
public static void logAndThrowRunTimeException(String errMsgFormat, Throwable t, Object... args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the parameters is tricky.
I wonder if it would be cleaner to have the Throwable first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will modify the code.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@goiri Please help to review the code again, thank you very much! |
🎊 +1 overall
This message was automatically generated. |
@goiri Thank you very much for your help reviewing the code, I will follow up with YARN-11227. |
@goiri Thank you very much for helping to review the code, can you help merge to trunk branch? I will follow up with YARN-11227. |
@goiri Thank you very much for helping to review the code! |
JIRA: YARN-11228. [Federation] Add getAppAttempts, getAppAttempt REST APIs for Router.