YARN-8239. [UI2] Clicking on Node Manager UI under AM container info / App Attempt page goes to old RM UI. Contributed by Sunil G.

This commit is contained in:
Rohith Sharma K S 2018-05-09 12:00:43 +05:30
parent 809135082a
commit eb7b256cc2
11 changed files with 39 additions and 7 deletions

View File

@ -61,4 +61,9 @@ public class AppAttemptMetricsConstants {
public static final String STATE_INFO =
"YARN_APPLICATION_ATTEMPT_STATE";
public static final String MASTER_NODE_ADDRESS =
"YARN_APPLICATION_ATTEMPT_MASTER_NODE_ADDRESS";
public static final String MASTER_NODE_ID =
"YARN_APPLICATION_ATTEMPT_MASTER_NODE_ID";
}

View File

@ -318,6 +318,10 @@ public void appAttemptRegistered(RMAppAttempt appAttempt,
if (appAttempt.getMasterContainer() != null) {
entityInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_INFO,
appAttempt.getMasterContainer().getId().toString());
entityInfo.put(AppAttemptMetricsConstants.MASTER_NODE_ADDRESS,
appAttempt.getMasterContainer().getNodeHttpAddress());
entityInfo.put(AppAttemptMetricsConstants.MASTER_NODE_ID,
appAttempt.getMasterContainer().getNodeId().toString());
}
entity.setInfo(entityInfo);
entity.setIdPrefix(

View File

@ -402,6 +402,9 @@ private static RMAppAttempt createRMAppAttempt(
Container container = mock(Container.class);
when(container.getId()).thenReturn(
ContainerId.newContainerId(appAttemptId, 1));
when(container.getNodeId())
.thenReturn(NodeId.newInstance("testhost", 8042));
when(container.getNodeHttpAddress()).thenReturn("testhost:25050");
when(appAttempt.getMasterContainer()).thenReturn(container);
when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info");
when(appAttempt.getTrackingUrl()).thenReturn("test tracking url");

View File

@ -382,8 +382,9 @@ export default Ember.Component.extend({
cellComponentName: 'em-table-html-cell',
getCellContent: function(row) {
var address = self.checkHttpProtocol(row.get('nodeHttpAddress'));
var link = row.get('masterNodeURL');
if (address) {
return `<a href="${address}" target="_blank">${address}</a>`;
return `<a href="${link}">${address}</a>`;
} else {
return 'N/A';
}
@ -483,8 +484,9 @@ export default Ember.Component.extend({
cellComponentName: 'em-table-html-cell',
getCellContent: function(row) {
var address = self.checkHttpProtocol(row.get('nodeHttpAddress'));
var link = row.get('masterNodeURL');
if (address) {
return `<a href="${address}" target="_blank">${address}</a>`;
return `<a href="${link}">${address}</a>`;
} else {
return 'N/A';
}

View File

@ -30,6 +30,7 @@ export default DS.Model.extend({
containerExitStatus: DS.attr('number'),
containerState: DS.attr('string'),
nodeHttpAddress: DS.attr('string'),
nodeId: DS.attr('string'),
startTs: function() {
return Converter.dateToTimeStamp(this.get("startedTime"));
@ -60,4 +61,9 @@ export default DS.Model.extend({
"</p><p>ElapsedTime:" +
String(this.get("elapsedTime")) + "</p>";
}.property(),
masterNodeURL: function() {
var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"),
});

View File

@ -140,4 +140,8 @@ export default DS.Model.extend({
return this.get("state");
}.property(),
masterNodeURL: function() {
var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"),
});

View File

@ -30,6 +30,7 @@ export default DS.Model.extend({
containerExitStatus: DS.attr('number'),
containerState: DS.attr('string'),
nodeHttpAddress: DS.attr('string'),
nodeId: DS.attr('string'),
startTs: function() {
return Converter.dateToTimeStamp(this.get("startedTime"));
@ -60,4 +61,9 @@ export default DS.Model.extend({
"</p><p>ElapsedTime:" +
String(this.get("elapsedTime")) + "</p>";
}.property(),
masterNodeURL: function() {
var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"),
});

View File

@ -36,6 +36,7 @@ export default DS.JSONAPISerializer.extend({
logUrl: payload.logUrl,
containerExitStatus: payload.containerExitStatus,
containerState: payload.containerState,
nodeId : payload.nodeId,
nodeHttpAddress: payload.nodeHttpAddress
}
};

View File

@ -37,10 +37,10 @@ export default DS.JSONAPISerializer.extend({
finishedTime: Converter.timeStampToDate(finishedTime),
containerId: payload.info.YARN_APPLICATION_ATTEMPT_MASTER_CONTAINER,
amContainerId: payload.info.YARN_APPLICATION_ATTEMPT_MASTER_CONTAINER,
nodeHttpAddress: '',
nodeId: '',
nodeHttpAddress: payload.info.YARN_APPLICATION_ATTEMPT_MASTER_NODE_ADDRESS,
nodeId: payload.info.YARN_APPLICATION_ATTEMPT_MASTER_NODE_ID,
hosts: payload.info.YARN_APPLICATION_ATTEMPT_HOST,
state: payload.info.YARN_APPLICATION_ATTEMPT_HOST,
state: payload.info.YARN_APPLICATION_ATTEMPT_STATE,
logsLink: '',
appAttemptId: payload.id
}

View File

@ -40,7 +40,8 @@ export default DS.JSONAPISerializer.extend({
finishedTime: Converter.timeStampToDate(payload.info.YARN_CONTAINER_FINISHED_TIME),
nodeHttpAddress: payload.info.YARN_CONTAINER_ALLOCATED_HOST_HTTP_ADDRESS,
containerExitStatus: payload.info.YARN_CONTAINER_EXIT_STATUS,
containerState: payload.info.YARN_CONTAINER_STATE
containerState: payload.info.YARN_CONTAINER_STATE,
nodeId: payload.info.YARN_CONTAINER_ALLOCATED_HOST + ':' + payload.info.YARN_CONTAINER_ALLOCATED_PORT,
}
};
return fixedPayload;

View File

@ -51,7 +51,7 @@
{{#if container.nodeHttpAddress}}
<tr>
<td>NodeManager UI</td>
<td title="{{container.nodeHttpAddress}}"><a href="{{prepend-protocol container.nodeHttpAddress}}" target="_blank">{{container.nodeHttpAddress}}</a></td>
<td title="{{container.nodeHttpAddress}}"><a href="{{container.masterNodeURL}}">{{container.nodeHttpAddress}}</a></td>
</tr>
{{/if}}
{{#if container.logUrl}}