From ec08eed5421e4832db156777795896d607c9a525 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Thu, 14 Feb 2019 20:55:43 +0530 Subject: [PATCH] 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. (cherry picked from commit d321d0e747ec91f6b66fe8eb73ea3b9ef99825ae) --- .../src/main/webapp/app/components/timeline-view.js | 12 ++++++------ .../src/main/webapp/app/controllers/yarn-app/logs.js | 9 +++++++-- .../src/main/webapp/app/helpers/log-files-comma.js | 2 +- .../src/main/webapp/app/models/yarn-app-attempt.js | 6 ++++++ .../src/main/webapp/app/models/yarn-container.js | 7 +++++++ .../webapp/app/models/yarn-timeline-container.js | 7 +++++++ .../src/main/webapp/app/routes/yarn-app/logs.js | 6 ++++++ .../main/webapp/app/routes/yarn-node-container.js | 8 +++++--- .../app/templates/components/app-attempt-table.hbs | 8 +++++--- .../app/templates/components/container-table.hbs | 8 +++++--- .../src/main/webapp/app/templates/yarn-app.hbs | 4 ++-- .../src/main/webapp/app/templates/yarn-apps/apps.hbs | 2 ++ .../src/main/webapp/app/templates/yarn-node/info.hbs | 4 +--- 13 files changed, 60 insertions(+), 23 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js index f09f42eb12b..092cbe96040 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js @@ -395,9 +395,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 `Link`; + var containerLogUrl = row.get('appAttemptContainerLogsURL'); + if (containerLogUrl) { + return `Link`; } else { return 'N/A'; } @@ -470,9 +470,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 `${url}`; + var containerLogUrl = row.get('appAttemptContainerLogsURL'); + if (containerLogUrl) { + return `Link`; } else { return 'N/A'; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/logs.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/logs.js index 82240117327..e1a8ec8dc27 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/logs.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/logs.js @@ -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); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js index 026cd7f9916..963fc1418c1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js @@ -47,7 +47,7 @@ export default Ember.Helper.helper(function(params,hash) { nodeAddr + '/' + containerId + '/' + logFileName + '">' + logFileName + ''; if (i !== logFilesLen - 1) { - html = html + ","; + html = html + ", "; } } html = html + ''; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js index f4836954b21..134ab7266dd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js @@ -146,4 +146,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") }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js index 7482a2fe998..4086be0731a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js @@ -66,4 +66,11 @@ export default DS.Model.extend({ var addr = encodeURIComponent(this.get("nodeHttpAddress")); return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`; }.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") }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-timeline-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-timeline-container.js index 9384418d992..c734fb5fabe 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-timeline-container.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-timeline-container.js @@ -67,4 +67,11 @@ export default DS.Model.extend({ var addr = encodeURIComponent(this.get("nodeHttpAddress")); return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`; }.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") }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app/logs.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app/logs.js index 99e4cff093b..b73bc80f175 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app/logs.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app/logs.js @@ -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() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js index 388918ed529..0060e2bbb52 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js @@ -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 } }); }, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs index dc0397a6c0c..e842e39e752 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/app-attempt-table.hbs @@ -56,10 +56,12 @@ {{attempt.nodeHttpAddress}} {{/if}} - {{#if attempt.logsLink}} + {{#if attempt.appAttemptContainerLogsURL}} - Log - Link + Logs + + Link + {{/if}} {{#if attempt.diagnosticsInfo}} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs index 139b7eb9bec..97164acf317 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs @@ -54,10 +54,12 @@ {{container.nodeHttpAddress}} {{/if}} - {{#if container.logUrl}} + {{#if container.appAttemptContainerLogsURL}} - Log - Link + Logs + + Link + {{/if}} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs index 6e9bc088627..c16a7a5f7c9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs @@ -19,7 +19,7 @@ {{breadcrumb-bar breadcrumbs=breadcrumbs}} {{#if actionResponse}} -
+
{{/if}} -
+
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs index f740083b8a8..743e2bfa74b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs @@ -20,7 +20,9 @@

Loading...

{{else}} {{#if model.apps}} +
{{em-table columns=columns rows=model.apps definition=tableDefinition}} +
{{else}}

Could not find any applications from this cluster

{{/if}} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node/info.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node/info.hbs index a2c708e2ea7..59cbbf0abd2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node/info.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node/info.hbs @@ -129,9 +129,7 @@
-
  • - Resources - yarn.io/gpu -
  • + Resources - yarn.io/gpu
    {{donut-chart data=model.rmNode.getGpuDataForDonutChart