-
Notifications
You must be signed in to change notification settings - Fork 9.1k
YARN-11310. [Federation] Refactoring Yarn Router's Federation Web Page. #4924
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. |
Configuration conf = this.router.getConfig(); | ||
boolean isEnabled = conf.getBoolean( |
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 was fine as it was.
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.
initFederationBlockTableJs?
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 a lot for your help reviewing the code, I'll fix it.
...server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationBlock.java
Show resolved
Hide resolved
} | ||
|
||
private static void initFederationBlockTableJs(Block html, List<Map<String, String>> jsonMap) { | ||
Gson gson =new Gson(); |
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.
Space
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'll fix it.
return null; | ||
} | ||
|
||
private static void initFederationBlockTableJs(Block html, List<Map<String, String>> jsonMap) { |
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.
Add javadoc explaining what table this sets.
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 add the java doc to explain the setting of this function for basic information.
" <td>" + | ||
" <h3>Resource Metrics</h3>" + | ||
" <h4>Memory</h4>" + | ||
" totalMB : '+capabilityObj.totalMB+' </p>" + |
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.
Spacing
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'll fix it.
@@ -47,10 +48,10 @@ protected Class<? extends SubView> content() { | |||
|
|||
private String rmsTableInit() { | |||
StringBuilder b = tableInit().append(", aoColumnDefs: ["); | |||
b.append("{'bSearchable': false, 'aTargets': [ 7 ]}") | |||
b.append("{'bSearchable': false, 'aTargets': [ 2 ]}") |
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 we are at it, can we make this numbers variables with names?
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'll fix it.
} else { | ||
setTitle("Federation is not Enabled!"); | ||
// When Federation is not enabled, user information needs to be prompted |
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.
It might be cleaner to have the if (!isEnabled)
first and return after this.
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. |
@goiri Please help to review the code again, thank you very much! Modify web page style
|
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
} else { | ||
setTitle("Federation is not Enabled!"); | ||
// If Yarn Federation is not enabled. | ||
if(!isEnabled) { |
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.
else?
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.
List<Map<String, String>> subClusterDetailMap) { | ||
Gson gson = new Gson(); | ||
html.script().$type("text/javascript"). | ||
__("$(document).ready(function() { " + |
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 massive string with double embedding is very dangerous.
Isn't there a better way to have some javascript file and some html template?
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 in reviewing the code, I agree with you, I will add js file.
// Binding to the FederationStateStore | ||
FederationStateStoreFacade facade = FederationStateStoreFacade.getInstance(); | ||
|
||
Map<SubClusterId, SubClusterInfo> subClustersInfo = |
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.
Single line?
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.
// Prepare Node | ||
long totalNodes = subClusterInfo.getTotalNodes(); | ||
long activeNodes = subClusterInfo.getActiveNodes(); | ||
String nodes = String.format("<Total Nodes:%s, Active Nodes:%s>", |
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.
Single line?
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.
@@ -33,8 +33,9 @@ class FederationPage extends RouterView { | |||
@Override | |||
protected void preHead(Page.HTML<__> html) { | |||
commonPreHead(html); | |||
setTitle("Federation"); | |||
setTitle("About The Federation"); |
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 think it makes more sense to have About YARN federation
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.
@@ -34,7 +34,7 @@ public class RouterController extends Controller { | |||
|
|||
@Override | |||
public void index() { | |||
setTitle("Router"); | |||
setTitle("About the Router"); |
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.
About the YARN Router
?
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. |
💔 -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. |
' AvailableVirtualCore : '+capabilityObj.availableVirtualCores+' </p>'+ | ||
' AllocatedVirtualCores : '+capabilityObj.allocatedVirtualCores+' </p>'+ | ||
' PendingVirtualCores : '+capabilityObj.pendingVirtualCores+' </p>'+ | ||
' <h4>Containers</h4>'+ |
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.
Spaces before and after the plus sign
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 helping to review the code, 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 your help reviewing the code! |
JIRA: YARN-11310. [Yarn Federation] Refactoring Router's Federation Web Page.
The Yarn Federation page before modification is as follows:
Enable Federation

Federation is not enabled

The page needs to be optimized as follows:
1.Title is inaccurate, should be "About The Federation"
2.If the user does not configure federation.enable, the page should prompt information instead of showing blank.
3.For cluster information, we care more about the current sub-cluster status, registration time, heartbeat time, etc., rather than capacity information. Detailed information can be displayed when clicking on the header
The Yarn Federation page after modification is as follows:
Enable federation
When we click
SC-1
, we can expand the information of the cluster, and when we click SC-1 again, we can hide the information of the cluster/Federation is not enabled
We prompt the user that Federation is not turned on, and give a configuration guide link
For screenshots of the operation, please refer to the following link
https://issues.apache.org/jira/secure/attachment/13049621/Federation_Web_Page.gif