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

View File

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

View File

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

View File

@ -113,7 +113,8 @@ function getClusterIdFromYARN(rmhost, application) {
function getNodeManagerPort(rmhost, application) {
var httpUrl = window.location.protocol + "//" +
(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";
$.ajax({
type: 'GET',
@ -158,6 +159,7 @@ function updateConfigs(application) {
ENV.clusterId = clusterIdFromYARN;
var nodeManagerPort = getNodeManagerPort(rmhost, application);
Ember.Logger.log("NodeMananger port: " + nodeManagerPort);
ENV.nodeManagerPort = nodeManagerPort;
if(!ENV.hosts.timelineWebAddress) {

View File

@ -147,4 +147,10 @@ export default DS.Model.extend({
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.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() {
var addr = encodeURIComponent(this.get("nodeHttpAddress"));
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() {
var addr = encodeURIComponent(this.get("nodeHttpAddress"));
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() {
const controller = this.controllerFor("yarn-app.logs");
const { attempt, containerid } = this.paramsFor('yarn-app.logs');
controller.resetAfterRefresh();
controller.initializeSelect();
if (attempt) {
controller.send("showContainersForAttemptId", attempt, containerid);
} else {
controller.set("selectedAttemptId", "");
}
},
unloadAll() {

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@
{{breadcrumb-bar breadcrumbs=breadcrumbs}}
{{#if actionResponse}}
<div class="row">
<div class="alert-wrapper">
<div class="col-md-12">
<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>
@ -29,7 +29,7 @@
</div>
{{/if}}
<div class="panel-group">
<div class="panel-group col-md-12">
<div class="panel panel-default">
<div class="yarn-app-header">
<div class="flex">

View File

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

View File

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