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 @@