YARN-7761. [UI2] Clicking 'master container log' or 'Link' next to 'log' under application's appAttempt goes to Old UI's Log link. Contributed by Akhil PB.

This commit is contained in:
Rohith Sharma K S 2019-01-25 14:00:19 +05:30
parent 9fc7df8afb
commit 84bb9808a2
14 changed files with 65 additions and 26 deletions

View File

@ -408,9 +408,9 @@ export default Ember.Component.extend({
contentPath: 'logsLink', contentPath: 'logsLink',
cellComponentName: 'em-table-html-cell', cellComponentName: 'em-table-html-cell',
getCellContent: function(row) { getCellContent: function(row) {
var logUrl = self.checkHttpProtocol(row.get('logsLink')); var containerLogUrl = row.get('appAttemptContainerLogsURL');
if (logUrl) { if (containerLogUrl) {
return `<a href="${logUrl}" target="_blank">Link</a>`; return `<a href="${containerLogUrl}">Link</a>`;
} else { } else {
return 'N/A'; return 'N/A';
} }
@ -490,9 +490,9 @@ export default Ember.Component.extend({
contentPath: 'logUrl', contentPath: 'logUrl',
cellComponentName: 'em-table-html-cell', cellComponentName: 'em-table-html-cell',
getCellContent: function(row) { getCellContent: function(row) {
var url = self.checkHttpProtocol(row.get('logUrl')); var containerLogUrl = row.get('appAttemptContainerLogsURL');
if (url) { if (containerLogUrl) {
return `<a href="${url}" target="_blank">${url}</a>`; return `<a href="${containerLogUrl}">Link</a>`;
} else { } else {
return 'N/A'; return 'N/A';
} }

View File

@ -20,8 +20,10 @@ import Ember from 'ember';
import Constants from 'yarn-ui/constants'; import Constants from 'yarn-ui/constants';
export default Ember.Controller.extend({ export default Ember.Controller.extend({
queryParams: ["service"], queryParams: ["service", "attempt", "containerid"],
service: undefined, service: undefined,
attempt: undefined,
containerid: undefined,
selectedAttemptId: "", selectedAttemptId: "",
attemptContainerList: null, attemptContainerList: null,
@ -40,7 +42,7 @@ export default Ember.Controller.extend({
}, },
actions: { actions: {
showContainersForAttemptId(attemptId) { showContainersForAttemptId(attemptId, containerId = "") {
this.set("selectedAttemptId", ""); this.set("selectedAttemptId", "");
if (attemptId) { if (attemptId) {
this.set("_isLoadingTopPanel", true); this.set("_isLoadingTopPanel", true);
@ -75,6 +77,9 @@ export default Ember.Controller.extend({
} }
this.set("attemptContainerList", containers); this.set("attemptContainerList", containers);
this.initializeSelect(".js-fetch-logs-containers"); this.initializeSelect(".js-fetch-logs-containers");
if (containerId) {
this.send("showLogFilesForContainerId", containerId);
}
}) })
.finally(() => { .finally(() => {
this.set("_isLoadingTopPanel", false); this.set("_isLoadingTopPanel", false);

View File

@ -47,7 +47,7 @@ export default Ember.Helper.helper(function(params,hash) {
nodeAddr + '/' + containerId + '/' + logFileName + '">' + logFileName + nodeAddr + '/' + containerId + '/' + logFileName + '">' + logFileName +
'</a>'; '</a>';
if (i !== logFilesLen - 1) { if (i !== logFilesLen - 1) {
html = html + ","; html = html + ", ";
} }
} }
html = html + '</td>'; html = html + '</td>';

View File

@ -113,7 +113,8 @@ function getClusterIdFromYARN(rmhost, application) {
function getNodeManagerPort(rmhost, application) { function getNodeManagerPort(rmhost, application) {
var httpUrl = window.location.protocol + "//" + var httpUrl = window.location.protocol + "//" +
(ENV.hosts.localBaseAddress ? ENV.hosts.localBaseAddress + '/' : '') + rmhost (ENV.hosts.localBaseAddress ? ENV.hosts.localBaseAddress + '/' : '') + rmhost
+ ":" + window.location.port + "/conf?name=yarn.nodemanager.webapp.address"; + "/conf?name=yarn.nodemanager.webapp.address";
var port = "8042"; var port = "8042";
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
@ -158,6 +159,7 @@ function updateConfigs(application) {
ENV.clusterId = clusterIdFromYARN; ENV.clusterId = clusterIdFromYARN;
var nodeManagerPort = getNodeManagerPort(rmhost, application); var nodeManagerPort = getNodeManagerPort(rmhost, application);
Ember.Logger.log("NodeMananger port: " + nodeManagerPort);
ENV.nodeManagerPort = nodeManagerPort; ENV.nodeManagerPort = nodeManagerPort;
if(!ENV.hosts.timelineWebAddress) { if(!ENV.hosts.timelineWebAddress) {

View File

@ -147,4 +147,10 @@ export default DS.Model.extend({
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`; return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"), }.property("nodeId", "nodeHttpAddress"),
appAttemptContainerLogsURL: function() {
const attemptId = this.get("id");
const containerId = this.get("appMasterContainerId");
const appId = Converter.attemptIdToAppId(attemptId);
return `#/yarn-app/${appId}/logs?attempt=${attemptId}&containerid=${containerId}`;
}.property("id", "appMasterContainerId")
}); });

View File

@ -66,5 +66,12 @@ export default DS.Model.extend({
masterNodeURL: function() { masterNodeURL: function() {
var addr = encodeURIComponent(this.get("nodeHttpAddress")); var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`; return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress") }.property("nodeId", "nodeHttpAddress"),
appAttemptContainerLogsURL: function() {
const containerId = this.get("id");
const attemptId = Converter.containerIdToAttemptId(containerId);
const appId = Converter.attemptIdToAppId(attemptId);
return `#/yarn-app/${appId}/logs?attempt=${attemptId}&containerid=${containerId}`;
}.property("id")
}); });

View File

@ -67,5 +67,12 @@ export default DS.Model.extend({
masterNodeURL: function() { masterNodeURL: function() {
var addr = encodeURIComponent(this.get("nodeHttpAddress")); var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`; return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress") }.property("nodeId", "nodeHttpAddress"),
appAttemptContainerLogsURL: function() {
const containerId = this.get("id");
const attemptId = Converter.containerIdToAttemptId(containerId);
const appId = Converter.attemptIdToAppId(attemptId);
return `#/yarn-app/${appId}/logs?attempt=${attemptId}&containerid=${containerId}`;
}.property("id")
}); });

View File

@ -37,8 +37,14 @@ export default AbstractRoute.extend(AppAttemptMixin, {
activate() { activate() {
const controller = this.controllerFor("yarn-app.logs"); const controller = this.controllerFor("yarn-app.logs");
const { attempt, containerid } = this.paramsFor('yarn-app.logs');
controller.resetAfterRefresh(); controller.resetAfterRefresh();
controller.initializeSelect(); controller.initializeSelect();
if (attempt) {
controller.send("showContainersForAttemptId", attempt, containerid);
} else {
controller.set("selectedAttemptId", "");
}
}, },
unloadAll() { unloadAll() {

View File

@ -22,12 +22,14 @@ import AbstractRoute from './abstract';
export default AbstractRoute.extend({ export default AbstractRoute.extend({
model(param) { model(param) {
let nodeAddress = decodeURIComponent(param.node_addr);
nodeAddress = nodeAddress.replace(/(^\w+:|^)\/\//, '');
// Get a specific container running on a specific node. // Get a specific container running on a specific node.
return Ember.RSVP.hash({ return Ember.RSVP.hash({
nodeContainer: this.store.queryRecord('yarn-node-container', nodeContainer: this.store.queryRecord('yarn-node-container',
{ nodeHttpAddr: param.node_addr, containerId: param.container_id }), { nodeHttpAddr: nodeAddress, containerId: param.container_id }),
nmGpuInfo: this.store.findRecord('yarn-nm-gpu', param.node_addr, {reload:true}), nmGpuInfo: this.store.findRecord('yarn-nm-gpu', nodeAddress, {reload:true}),
nodeInfo: { id: param.node_id, addr: param.node_addr, containerId: param.container_id } nodeInfo: { id: param.node_id, addr: nodeAddress, containerId: param.container_id }
}); });
}, },

View File

@ -62,10 +62,12 @@
<td title="{{attempt.exposedPorts}}">{{attempt.exposedPorts}}</td> <td title="{{attempt.exposedPorts}}">{{attempt.exposedPorts}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if attempt.logsLink}} {{#if attempt.appAttemptContainerLogsURL}}
<tr> <tr>
<td>Log</td> <td>Logs</td>
<td><a href="{{prepend-protocol attempt.logsLink}}" target="_blank">Link</a></td> <td>
<a href="{{attempt.appAttemptContainerLogsURL}}">Link</a>
</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if attempt.diagnosticsInfo}} {{#if attempt.diagnosticsInfo}}

View File

@ -60,10 +60,12 @@
<td title="{{container.exposedPorts}}">{{container.exposedPorts}}</td> <td title="{{container.exposedPorts}}">{{container.exposedPorts}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if container.logUrl}} {{#if container.appAttemptContainerLogsURL}}
<tr> <tr>
<td>Log</td> <td>Logs</td>
<td><a href="{{prepend-protocol container.logUrl}}" target="_blank">Link</a></td> <td>
<a href="{{container.appAttemptContainerLogsURL}}">Link</a>
</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if container.nodeHttpAddress}} {{#if container.nodeHttpAddress}}

View File

@ -19,7 +19,7 @@
{{breadcrumb-bar breadcrumbs=breadcrumbs}} {{breadcrumb-bar breadcrumbs=breadcrumbs}}
{{#if actionResponse}} {{#if actionResponse}}
<div class="row"> <div class="alert-wrapper">
<div class="col-md-12"> <div class="col-md-12">
<div class="alert alert-dismissible {{if (eq actionResponse.type 'error') 'alert-danger' 'alert-success'}}" role="alert"> <div class="alert alert-dismissible {{if (eq actionResponse.type 'error') 'alert-danger' 'alert-success'}}" role="alert">
<button class="close" data-dismiss="alert" aria-label="Close" {{action "resetActionResponse"}}><span aria-hidden="true">&times;</span></button> <button class="close" data-dismiss="alert" aria-label="Close" {{action "resetActionResponse"}}><span aria-hidden="true">&times;</span></button>
@ -29,7 +29,7 @@
</div> </div>
{{/if}} {{/if}}
<div class="panel-group"> <div class="panel-group col-md-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="yarn-app-header"> <div class="yarn-app-header">
<div class="flex"> <div class="flex">

View File

@ -20,7 +20,9 @@
<h4 align="center">Loading...</h4> <h4 align="center">Loading...</h4>
{{else}} {{else}}
{{#if model.apps}} {{#if model.apps}}
<div class="col-md-12">
{{em-table columns=columns rows=model.apps definition=tableDefinition}} {{em-table columns=columns rows=model.apps definition=tableDefinition}}
</div>
{{else}} {{else}}
<h4 align="center">Could not find any applications from this cluster</h4> <h4 align="center">Could not find any applications from this cluster</h4>
{{/if}} {{/if}}

View File

@ -129,9 +129,7 @@
<div class="col-lg-6 container-fluid"> <div class="col-lg-6 container-fluid">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<li> Resources - yarn.io/gpu
Resources - yarn.io/gpu
</li>
</div> </div>
<div class="container-fluid" id="gpu-donut-chart"> <div class="container-fluid" id="gpu-donut-chart">
{{donut-chart data=model.rmNode.getGpuDataForDonutChart {{donut-chart data=model.rmNode.getGpuDataForDonutChart