-
Notifications
You must be signed in to change notification settings - Fork 9.2k
YARN-11442. Refactor FederationInterceptorREST Code. #5420
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
Conversation
|
💔 -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. |
|
💔 -1 overall
This message was automatically generated. |
| // Create a duplicate hsr. | ||
| final HttpServletRequest hsrCopy = clone(hsr); | ||
|
|
||
|
|
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.
Needed three break lines?
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.
Thank you for your help to review the code, I will modify the code. This part of the code, I need to continue to improve.
|
💔 -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. |
| * an exception will be thrown (No active SubCluster available to submit the request.) | ||
| */ | ||
| public static SubClusterId getRandomActiveSubCluster( | ||
| public SubClusterId getRandomActiveSubCluster( |
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.
Isn't this still static?
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 should change the places where we call it to call it as static.
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.
Thank you very much for your help to review the code! This part of the code can continue to be static, I will modify the code.
| throws YarnException, IOException, InterruptedException { | ||
| throws YarnException { | ||
| SubClusterId subClusterId = | ||
| federationFacade.getRandomActiveSubCluster(subClustersActive, blackList); |
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.
Just make this call static.
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 fix it.
| ApplicationId applicationId = null; | ||
| try { | ||
| applicationId = ApplicationId.fromString(appId); | ||
| ApplicationId.fromString(appId); |
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.
Why do we do this if we don't use it?
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 the reminder, I will improve this part of the code again.
| getOrCreateInterceptorForSubCluster(subClusterId, | ||
| subClusterInfo.getRMWebServiceAddress()); | ||
| // Call the appState interface. | ||
| DefaultRequestInterceptorREST interceptor = getOrCreateInterceptorForSubCluster(subClusterInfo); |
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.
As you are consolidating, you could create methods with appId and nodeId.
|
|
||
| try { | ||
| long startTime = clock.getTime(); | ||
| SubClusterInfo subClusterInfo = getHomeSubClusterInfoByAppId(appId); |
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.
Create one with appId and then you do the proper check for null, etc.
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.
| * application does not exist in StateStore. | ||
| */ | ||
| @Test | ||
| public void testGetApplicationStateNotExists() |
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.
One line?
| Assert.assertNotNull(entity); | ||
| Assert.assertNotNull(entity instanceof ReservationListInfo); | ||
|
|
||
| assert entity instanceof ReservationListInfo; |
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.
Do a junit Assert.assertTrue()
|
💔 -1 overall
This message was automatically generated. |
|
|
||
| numSubmitRetries = conf.getInt( | ||
| YarnConfiguration.ROUTER_CLIENTRM_SUBMIT_RETRY, | ||
| numSubmitRetries = conf.getInt(YarnConfiguration.ROUTER_CLIENTRM_SUBMIT_RETRY, |
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.
Avoid this change. It looked ok before.
|
🎊 +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. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
|
||
| protected DefaultRequestInterceptorREST getOrCreateInterceptorByAppId(String appId) | ||
| throws YarnException { | ||
| SubClusterInfo subClusterInfo = getHomeSubClusterInfoByAppId(appId); |
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.
Why not doing the validation of the appId here?
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.
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
@goiri Thank you very much for helping to review the code! |
JIRA: YARN-11442. Refactor FederationInterceptorREST Code.
Fix code issues to make code more readable