Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E1CC72009A8 for ; Tue, 17 May 2016 22:18:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E05641609F5; Tue, 17 May 2016 20:18:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A0D19160A20 for ; Tue, 17 May 2016 22:18:12 +0200 (CEST) Received: (qmail 93921 invoked by uid 500); 17 May 2016 20:17:53 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 91562 invoked by uid 99); 17 May 2016 20:17:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 May 2016 20:17:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ED306DFBAB; Tue, 17 May 2016 20:17:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: wangda@apache.org To: common-commits@hadoop.apache.org Date: Tue, 17 May 2016 20:18:39 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [49/50] [abbrv] hadoop git commit: YARN-4517. Add nodes page and fix bunch of license issues. (Varun Saxena via wangda) archived-at: Tue, 17 May 2016 20:18:16 -0000 YARN-4517. Add nodes page and fix bunch of license issues. (Varun Saxena via wangda) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/9a7488b6 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/9a7488b6 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/9a7488b6 Branch: refs/heads/YARN-3368 Commit: 9a7488b695ae606baf0aac5372e5b9ad10396f0a Parents: 137c67d Author: Wangda Tan Authored: Mon Mar 21 13:13:02 2016 -0700 Committer: Wangda Tan Committed: Tue May 17 13:12:37 2016 -0700 ---------------------------------------------------------------------- .../hadoop-yarn-ui/app/adapters/cluster-info.js | 5 +- .../app/adapters/cluster-metric.js | 5 +- .../app/adapters/yarn-app-attempt.js | 3 +- .../hadoop-yarn-ui/app/adapters/yarn-app.js | 3 +- .../app/adapters/yarn-container-log.js | 74 +++++++++ .../app/adapters/yarn-container.js | 5 +- .../app/adapters/yarn-node-app.js | 63 ++++++++ .../app/adapters/yarn-node-container.js | 64 ++++++++ .../hadoop-yarn-ui/app/adapters/yarn-node.js | 40 +++++ .../hadoop-yarn-ui/app/adapters/yarn-queue.js | 3 +- .../hadoop-yarn-ui/app/adapters/yarn-rm-node.js | 45 ++++++ .../app/components/simple-table.js | 38 ++++- .../hadoop-yarn/hadoop-yarn-ui/app/config.js | 27 ++++ .../hadoop-yarn/hadoop-yarn-ui/app/constants.js | 24 +++ .../app/controllers/application.js | 55 +++++++ .../hadoop-yarn-ui/app/helpers/divide.js | 31 ++++ .../app/helpers/log-files-comma.js | 48 ++++++ .../hadoop-yarn-ui/app/helpers/node-link.js | 37 +++++ .../hadoop-yarn-ui/app/helpers/node-menu.js | 66 ++++++++ .../hadoop-yarn-ui/app/models/yarn-app.js | 14 +- .../app/models/yarn-container-log.js | 25 +++ .../hadoop-yarn-ui/app/models/yarn-node-app.js | 44 ++++++ .../app/models/yarn-node-container.js | 57 +++++++ .../hadoop-yarn-ui/app/models/yarn-node.js | 33 ++++ .../hadoop-yarn-ui/app/models/yarn-rm-node.js | 92 +++++++++++ .../hadoop-yarn/hadoop-yarn-ui/app/router.js | 13 ++ .../hadoop-yarn-ui/app/routes/application.js | 38 +++++ .../hadoop-yarn-ui/app/routes/index.js | 29 ++++ .../hadoop-yarn-ui/app/routes/yarn-apps.js | 4 +- .../app/routes/yarn-container-log.js | 55 +++++++ .../hadoop-yarn-ui/app/routes/yarn-node-app.js | 29 ++++ .../hadoop-yarn-ui/app/routes/yarn-node-apps.js | 29 ++++ .../app/routes/yarn-node-container.js | 30 ++++ .../app/routes/yarn-node-containers.js | 28 ++++ .../hadoop-yarn-ui/app/routes/yarn-node.js | 29 ++++ .../hadoop-yarn-ui/app/routes/yarn-nodes.js | 25 +++ .../app/serializers/yarn-container-log.js | 39 +++++ .../app/serializers/yarn-node-app.js | 86 +++++++++++ .../app/serializers/yarn-node-container.js | 74 +++++++++ .../hadoop-yarn-ui/app/serializers/yarn-node.js | 56 +++++++ .../app/serializers/yarn-rm-node.js | 77 ++++++++++ .../app/templates/application.hbs | 4 +- .../hadoop-yarn-ui/app/templates/error.hbs | 19 +++ .../hadoop-yarn-ui/app/templates/notfound.hbs | 20 +++ .../hadoop-yarn-ui/app/templates/yarn-apps.hbs | 4 +- .../app/templates/yarn-container-log.hbs | 36 +++++ .../app/templates/yarn-node-app.hbs | 60 ++++++++ .../app/templates/yarn-node-apps.hbs | 51 +++++++ .../app/templates/yarn-node-container.hbs | 70 +++++++++ .../app/templates/yarn-node-containers.hbs | 58 +++++++ .../hadoop-yarn-ui/app/templates/yarn-node.hbs | 94 ++++++++++++ .../hadoop-yarn-ui/app/templates/yarn-nodes.hbs | 65 ++++++++ .../hadoop-yarn-ui/app/utils/converter.js | 21 ++- .../hadoop-yarn-ui/app/utils/sorter.js | 42 ++++- .../hadoop-yarn/hadoop-yarn-ui/bower.json | 2 +- .../hadoop-yarn-ui/config/environment.js | 1 - .../unit/adapters/yarn-container-log-test.js | 73 +++++++++ .../tests/unit/adapters/yarn-node-app-test.js | 93 +++++++++++ .../unit/adapters/yarn-node-container-test.js | 93 +++++++++++ .../tests/unit/adapters/yarn-node-test.js | 42 +++++ .../tests/unit/adapters/yarn-rm-node-test.js | 44 ++++++ .../unit/models/yarn-container-log-test.js | 48 ++++++ .../tests/unit/models/yarn-node-app-test.js | 65 ++++++++ .../unit/models/yarn-node-container-test.js | 78 ++++++++++ .../tests/unit/models/yarn-node-test.js | 58 +++++++ .../tests/unit/models/yarn-rm-node-test.js | 95 ++++++++++++ .../unit/routes/yarn-container-log-test.js | 120 +++++++++++++++ .../tests/unit/routes/yarn-node-app-test.js | 56 +++++++ .../tests/unit/routes/yarn-node-apps-test.js | 60 ++++++++ .../unit/routes/yarn-node-container-test.js | 61 ++++++++ .../unit/routes/yarn-node-containers-test.js | 68 +++++++++ .../tests/unit/routes/yarn-node-test.js | 84 ++++++++++ .../tests/unit/routes/yarn-nodes-test.js | 74 +++++++++ .../unit/serializers/yarn-container-log-test.js | 49 ++++++ .../unit/serializers/yarn-node-app-test.js | 102 +++++++++++++ .../serializers/yarn-node-container-test.js | 128 ++++++++++++++++ .../tests/unit/serializers/yarn-node-test.js | 69 +++++++++ .../tests/unit/serializers/yarn-rm-node-test.js | 153 +++++++++++++++++++ .../tests/unit/utils/converter-test.js | 48 +++++- .../tests/unit/utils/sorter-test.js | 26 ++++ 80 files changed, 3840 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js index ef65792..5a0d2d3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-info.js @@ -1,10 +1,11 @@ import DS from 'ember-data'; +import Config from 'yarn-ui/config'; export default DS.JSONAPIAdapter.extend({ headers: { Accept: 'application/json' }, - host: 'http://localhost:1337/localhost:8088', // configurable + host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable namespace: 'ws/v1/cluster', // common const pathForType(modelName) { return ''; // move to some common place, return path by modelname. @@ -16,4 +17,4 @@ export default DS.JSONAPIAdapter.extend({ hash.targetServer = "RM"; return this._super(url, method, hash); } -}); \ No newline at end of file +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js index d0f084c..d392c9b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/cluster-metric.js @@ -1,10 +1,11 @@ import DS from 'ember-data'; +import Config from 'yarn-ui/config'; export default DS.JSONAPIAdapter.extend({ headers: { Accept: 'application/json' }, - host: 'http://localhost:1337/localhost:8088', // configurable + host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable namespace: 'ws/v1/cluster/metrics', // common const pathForType(modelName) { return ''; // move to some common place, return path by modelname. @@ -16,4 +17,4 @@ export default DS.JSONAPIAdapter.extend({ hash.targetServer = "RM"; return this._super(url, method, hash); } -}); \ No newline at end of file +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js index 3c95d64..4e40744 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app-attempt.js @@ -1,11 +1,12 @@ import DS from 'ember-data'; import Converter from 'yarn-ui/utils/converter'; +import Config from 'yarn-ui/config'; export default DS.JSONAPIAdapter.extend({ headers: { Accept: 'application/json' }, - host: 'http://localhost:1337/localhost:8088', // configurable + host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable namespace: 'ws/v1/cluster', // common const urlForQuery(query, modelName) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js index e1108be..faff3e7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-app.js @@ -1,10 +1,11 @@ import DS from 'ember-data'; +import Config from 'yarn-ui/config'; export default DS.JSONAPIAdapter.extend({ headers: { Accept: 'application/json' }, - host: 'http://localhost:1337/localhost:8088', // configurable + host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable namespace: 'ws/v1/cluster', // common const pathForType(modelName) { return 'apps'; // move to some common place, return path by modelname. http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js new file mode 100644 index 0000000..7838c98 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container-log.js @@ -0,0 +1,74 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; +import Ember from 'ember'; +import Converter from 'yarn-ui/utils/converter'; + +/** + * REST URL's response when fetching container logs will be + * in plain text format and not JSON. + */ +export default DS.RESTAdapter.extend({ + headers: { + Accept: 'text/plain' + }, + host: 'http://localhost:1337/', + namespace: 'ws/v1/node', + + urlForFindRecord(id, modelName, snapshot) { + var splits = Converter.splitForContainerLogs(id); + var nodeHttpAddr = splits[0]; + var containerId = splits[1]; + var filename = splits[2]; + this.host = this.host + nodeHttpAddr; + var url = this._buildURL(); + url = url + "/containerlogs/" + containerId + "/" + filename; + return url; + }, + + ajax(url, method, hash) { + hash = hash || {}; + hash.crossDomain = true; + hash.xhrFields = {withCredentials: true}; + hash.targetServer = "NM"; + return this._super(url, method, hash); + }, + + /** + * Override options so that result is not expected to be JSON + */ + ajaxOptions: function (url, type, options) { + var hash = options || {}; + hash.url = url; + hash.type = type; + // Make sure jQuery does not try to convert response to JSON. + hash.dataType = 'text'; + hash.context = this; + + var headers = Ember.get(this, 'headers'); + if (headers != undefined) { + hash.beforeSend = function (xhr) { + Object.keys(headers).forEach(function (key) { + return xhr.setRequestHeader(key, headers[key]); + }); + }; + } + return hash; + }, +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js index fe09f59..d941c38 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-container.js @@ -1,12 +1,13 @@ import DS from 'ember-data'; import Converter from 'yarn-ui/utils/converter'; +import Config from 'yarn-ui/config'; export default DS.JSONAPIAdapter.extend({ headers: { Accept: 'application/json' }, - rmHost: 'http://localhost:1337/localhost:8088', - tsHost: 'http://localhost:1337/localhost:8188', + rmHost: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, + tsHost: 'http://localhost:1337/' + Config.TS_HOST + ':' + Config.TS_PORT, host: function() { return undefined }.property(), http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js new file mode 100644 index 0000000..0c60d1f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-app.js @@ -0,0 +1,63 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.JSONAPIAdapter.extend({ + headers: { + Accept: 'application/json' + }, + host: 'http://localhost:1337/', + namespace: 'ws/v1/node', + + urlForQuery(query) { + this.host = this.host + query.nodeAddr; + var url = this._buildURL(); + url = url + "/apps"; + return url; + }, + + urlForQueryRecord: function (query) { + this.host = this.host + query.nodeAddr; + var url = this._buildURL(); + url = url + "/apps/" + query.appId; + return url; + }, + + query: function (store, type, query) { + var url = this.urlForQuery(query); + // Query params not required. + query = null; + return this.ajax(url, 'GET', { data: query }); + }, + + queryRecord: function (store, type, query) { + var url = this.urlForQueryRecord(query); + // Query params not required. + query = null; + return this.ajax(url, 'GET', { data: query }); + }, + + ajax(url, method, hash) { + hash = hash || {}; + hash.crossDomain = true; + hash.xhrFields = {withCredentials: true}; + hash.targetServer = "NM"; + return this._super(url, method, hash); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js new file mode 100644 index 0000000..e8bf7b7 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node-container.js @@ -0,0 +1,64 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.JSONAPIAdapter.extend({ + headers: { + Accept: 'application/json' + }, + host: 'http://localhost:1337/', + namespace: 'ws/v1/node', + + urlForQuery(query) { + this.host = this.host + query.nodeHttpAddr; + var url = this._buildURL(); + url = url + "/containers"; + return url; + }, + + urlForQueryRecord(query) { + this.host = this.host + query.nodeHttpAddr; + var url = this._buildURL(); + url = url + "/containers/" + query.containerId; + return url; + }, + + query: function (store, type, query) { + var url = this.urlForQuery(query); + // Query params not required. + query = null; + return this.ajax(url, 'GET', { data: query }); + }, + + queryRecord: function (store, type, query) { + var url = this.urlForQueryRecord(query); + // Query params not required. + query = null; + console.log(url); + return this.ajax(url, 'GET', { data: query }); + }, + + ajax(url, method, hash) { + hash = hash || {}; + hash.crossDomain = true; + hash.xhrFields = {withCredentials: true}; + hash.targetServer = "NM"; + return this._super(url, method, hash); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js new file mode 100644 index 0000000..64f524a --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-node.js @@ -0,0 +1,40 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.JSONAPIAdapter.extend({ + headers: { + Accept: 'application/json' + }, + host: 'http://localhost:1337/', + namespace: 'ws/v1/node', + + urlForFindRecord(id, modelName, snapshot) { + this.host = this.host + id; + var url = this._buildURL(); + return url; + }, + ajax(url, method, hash) { + hash = hash || {}; + hash.crossDomain = true; + hash.xhrFields = {withCredentials: true}; + hash.targetServer = "NM"; + return this._super(url, method, hash); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js index 39cf796..0f6eb65 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-queue.js @@ -1,10 +1,11 @@ import DS from 'ember-data'; +import Config from 'yarn-ui/config'; export default DS.JSONAPIAdapter.extend({ headers: { Accept: 'application/json' }, - host: 'http://localhost:1337/localhost:8088', // configurable + host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable namespace: 'ws/v1/cluster', // common const pathForType(modelName) { return 'scheduler'; // move to some common place, return path by modelname. http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js new file mode 100644 index 0000000..c6ad6f3 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/adapters/yarn-rm-node.js @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; +import Config from 'yarn-ui/config'; + +export default DS.JSONAPIAdapter.extend({ + headers: { + Accept: 'application/json' + }, + host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, + namespace: 'ws/v1/cluster', + pathForType(modelName) { + return 'nodes'; + }, + + urlForFindRecord(id, modelName, snapshot) { + var url = this._buildURL(); + url = url + "/nodes/" + id; + return url; + }, + + ajax(url, method, hash) { + hash = hash || {}; + hash.crossDomain = true; + hash.xhrFields = {withCredentials: true}; + hash.targetServer = "RM"; + return this._super(url, method, hash); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js index ed8ff9b..447533e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/components/simple-table.js @@ -7,24 +7,52 @@ export default Ember.Component.extend({ var info = this.get("info") ? true : this.get("info"); var bFilter = this.get("bFilter") ? true : this.get("bFilter"); + // Defines sorter for the columns if not default. + // Can also specify a custom sorter. + var i; var colDefs = []; if (this.get("colTypes")) { var typesArr = this.get("colTypes").split(' '); var targetsArr = this.get("colTargets").split(' '); - for (var i = 0; i < typesArr.length; i++) { + for (i = 0; i < typesArr.length; i++) { + console.log(typesArr[i] + " " + targetsArr[i]); colDefs.push({ type: typesArr[i], targets: parseInt(targetsArr[i]) }); } } - - $('#' + this.get('table-id')).DataTable({ + // Defines initial column and sort order. + var orderArr = []; + if (this.get("colsOrder")) { + var cols = this.get("colsOrder").split(' '); + for (i = 0; i < cols.length; i++) { + var col = cols[i].split(','); + if (col.length != 2) { + continue; + } + var order = col[1].trim(); + if (order != 'asc' && order != 'desc') { + continue; + } + var colOrder = []; + colOrder.push(parseInt(col[0])); + colOrder.push(order); + orderArr.push(colOrder); + } + } + if (orderArr.length == 0) { + var defaultOrder = [0, 'asc']; + orderArr.push(defaultOrder); + } + console.log(orderArr[0]); + Ember.$('#' + this.get('table-id')).DataTable({ "paging": paging, "ordering": ordering, "info": info, "bFilter": bFilter, - columnDefs: colDefs + "order": orderArr, + "columnDefs": colDefs }); } -}); \ No newline at end of file +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js new file mode 100644 index 0000000..224c65a --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/config.js @@ -0,0 +1,27 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Host and port configurations + */ +export default { + RM_HOST: 'localhost', + RM_PORT: '8088', + TS_HOST: 'localhost', + TS_PORT: '8188', +}; http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js new file mode 100644 index 0000000..d2937a0 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/constants.js @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Application level global constants go here. + */ +export default { + PARAM_SEPARATOR: '!', +}; http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js new file mode 100644 index 0000000..3c68365 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/controllers/application.js @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +/** + * Base controller for application. + */ +export default Ember.Controller.extend({ + /** + * Output main top UI menu which is common across all pages. + * Menu item will be made active based on current path. + */ + outputMainMenu: function(){ + var path = this.get('currentPath'); + var html = 'Queues' + + '(current)Applications' + + '(current)Cluster Overview(current)Nodes' + + '(current)'; + return Ember.String.htmlSafe(html); + }.property('currentPath') +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js new file mode 100644 index 0000000..fcf64dd --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/divide.js @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ember from 'ember'; + +/** + * Helper assumes values are numeric. num means numerator and + * den means denominator. + */ +export default Ember.Helper.helper(function(params,hash) { + var num = hash.num; + var den = hash.den; + if (den == 0) { + return 0; + } + return Math.floor(num/den); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js new file mode 100644 index 0000000..8c29b34 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/log-files-comma.js @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +/** + * Represent log files as comma separated list. + */ +export default Ember.Helper.helper(function(params,hash) { + var logFiles = hash.logFiles; + if (logFiles == null) { + return ""; + } + var logFilesLen = logFiles.length; + if (logFilesLen == 0) { + return ""; + } + var nodeId = hash.nodeId; + var nodeAddr = hash.nodeAddr; + var containerId = hash.containerId; + var html = ''; + var logFilesCommaSeparated = ""; + for (var i = 0; i < logFilesLen; i++) { + html = html + '' + logFiles[i] + + ''; + if (i != logFilesLen - 1) { + html = html + ","; + } + } + html = html + ''; + return Ember.String.htmlSafe(html); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js new file mode 100644 index 0000000..99d975b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-link.js @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +/** + * Generate link to node page if its not SHUTDOWN or LOST. + */ +export default Ember.Helper.helper(function(params,hash) { + var nodeState = hash.nodeState; + var nodeHTTPAddress = hash.nodeHTTPAddress; + var nodeId = hash.nodeId; + var html = ''; + if (nodeState == "SHUTDOWN" || nodeState == "LOST") { + html = html + nodeHTTPAddress; + } else { + html = html + '' + + nodeHTTPAddress + ''; + } + html = html + ''; + return Ember.String.htmlSafe(html); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js new file mode 100644 index 0000000..589111f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/helpers/node-menu.js @@ -0,0 +1,66 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ember from 'ember'; + +/** + * Create left hand side node manager menu with menu item activated based + * on page being accessed. + */ +export default Ember.Helper.helper(function(params,hash) { + // Place a menu within a panel inside col-md-2 container. + var nodeIdSplitAtPort = hash.nodeId; + var portIndex = nodeIdSplitAtPort.indexOf(':'); + if (portIndex != -1) { + nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) + + ':​' + nodeIdSplitAtPort.substring(portIndex + 1); + } + var normalizedNodeId = ''; + var splitsAlongDots = nodeIdSplitAtPort.split('.'); + if (splitsAlongDots) { + var len = splitsAlongDots.length; + for (var i = 0; i < len; i++) { + normalizedNodeId = normalizedNodeId + splitsAlongDots[i]; + if (i != len - 1) { + normalizedNodeId = normalizedNodeId + '.​'; + } + } + } else { + normalizedNodeId = nodeIdSplitAtPort; + } + + var html = '
'+ + '

Node Manager
(' + normalizedNodeId + ')

'+ + ''; + return Ember.String.htmlSafe(html); +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js index cb79be1..fec2bd3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-app.js @@ -2,12 +2,12 @@ import Converter from 'yarn-ui/utils/converter'; import DS from 'ember-data'; export default DS.Model.extend({ - appName: DS.attr('string'), - user: DS.attr('string'), - queue: DS.attr('string'), - state: DS.attr('string'), - startTime: DS.attr('string'), - elapsedTime: DS.attr('string'), + appName: DS.attr('string'), + user: DS.attr('string'), + queue: DS.attr('string'), + state: DS.attr('string'), + startTime: DS.attr('string'), + elapsedTime: DS.attr('string'), finalStatus: DS.attr('string'), finishedTime: DS.attr('finishedTime'), progress: DS.attr('number'), @@ -62,4 +62,4 @@ export default DS.Model.extend({ return "label label-" + style; }.property("finalStatus") -}); \ No newline at end of file +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js new file mode 100644 index 0000000..31cf61e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-container-log.js @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.Model.extend({ + logs: DS.attr('string'), + containerID: DS.attr('string'), + logFileName: DS.attr('string') +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js new file mode 100644 index 0000000..6dc69ae --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-app.js @@ -0,0 +1,44 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.Model.extend({ + appId: DS.attr('string'), + state: DS.attr('string'), + user: DS.attr('string'), + containers: DS.attr('array'), + /** + * Indicates no rows were retrieved from backend + */ + isDummyApp: function() { + return this.get('id') == "dummy"; + }.property("id"), + + appStateStyle: function() { + var style = "default"; + var appState = this.get("state"); + if (appState == "RUNNING" || appState == "FINISHING_CONTAINERS_WAIT" || + appState == "APPLICATION_RESOURCES_CLEANINGUP") { + style = "primary"; + } else if (appState == "FINISHED") { + style = "success"; + } + return "label label-" + style; + }.property("state") +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js new file mode 100644 index 0000000..3ba3216 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node-container.js @@ -0,0 +1,57 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.Model.extend({ + containerId: DS.attr('string'), + state: DS.attr('string'), + user: DS.attr('string'), + exitCode: DS.attr('string'), + diagnostics: DS.attr('string'), + totalMemoryNeeded: DS.attr('number'), + totalVCoresNeeded: DS.attr('number'), + containerLogFiles: DS.attr('array'), + + /** + * Indicates that there was no container retrieved from backend. + */ + isDummyContainer: function() { + return this.get('id') == "dummy"; + }.property("id"), + + containerStateStyle: function() { + var style = "primary"; + var containerState = this.get('state'); + var containerExitCode = this.get('exitCode'); + if (containerState == "DONE") { + if (containerExitCode == "0") { + style = "success"; + } else if (containerExitCode != "N/A") { + style = "danger"; + } + } + if (containerState == "EXITED_WITH_SUCCESS") { + style = "success"; + } + if (containerState == "EXITED_WITH_FAILURE") { + style = "danger"; + } + return "label label-" + style; + }.property("state", "exitCode") +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js new file mode 100644 index 0000000..4753983 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-node.js @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.Model.extend({ + totalVmemAllocatedContainersMB: DS.attr('number'), + totalPmemAllocatedContainersMB: DS.attr('number'), + totalVCoresAllocatedContainers: DS.attr('number'), + vmemCheckEnabled: DS.attr('boolean'), + pmemCheckEnabled: DS.attr('boolean'), + nodeHealthy: DS.attr('boolean'), + lastNodeUpdateTime: DS.attr('string'), + healthReport: DS.attr('string'), + nmStartupTime: DS.attr('string'), + nodeManagerBuildVersion: DS.attr('string'), + hadoopBuildVersion: DS.attr('string'), +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js new file mode 100644 index 0000000..9a1082c --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/models/yarn-rm-node.js @@ -0,0 +1,92 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.Model.extend({ + rack: DS.attr('string'), + state: DS.attr('string'), + nodeHostName: DS.attr('string'), + nodeHTTPAddress: DS.attr('string'), + lastHealthUpdate: DS.attr('string'), + healthReport: DS.attr('string'), + numContainers: DS.attr('number'), + usedMemoryMB: DS.attr('number'), + availMemoryMB: DS.attr('number'), + usedVirtualCores: DS.attr('number'), + availableVirtualCores: DS.attr('number'), + version: DS.attr('string'), + nodeLabels: DS.attr('array'), + + nodeLabelsAsString: function() { + var labels = this.get("nodeLabels"); + var labelToReturn = ""; + // Only one label per node supported. + if (labels && labels.length > 0) { + labelToReturn = labels[0]; + } + return labelToReturn; + }.property("nodeLabels"), + + /** + * Indicates no rows were retrieved from backend + */ + isDummyNode: function() { + return this.get('id') == "dummy"; + }.property("id"), + + nodeStateStyle: function() { + var style = "default"; + var nodeState = this.get("state"); + if (nodeState == "REBOOTED") { + style = "warning"; + } else if (nodeState == "UNHEALTHY" || nodeState == "DECOMMISSIONED" || + nodeState == "LOST" || nodeState == "SHUTDOWN") { + style = "danger"; + } else if (nodeState == "RUNNING") { + style = "success"; + } + return "label label-" + style; + }.property("state"), + + getMemoryDataForDonutChart: function() { + var arr = []; + arr.push({ + label: "Used", + value: this.get("usedMemoryMB") + }); + arr.push({ + label: "Available", + value: this.get("availMemoryMB") + }); + return arr; + }.property("availMemoryMB", "usedMemoryMB"), + + getVCoreDataForDonutChart: function() { + var arr = []; + arr.push({ + label: "Used", + value: this.get("usedVirtualCores") + }); + arr.push({ + label: "Available", + value: this.get("availableVirtualCores") + }); + return arr; + }.property("availableVirtualCores", "usedVirtualCores"), +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js index c31190f..5db083e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/router.js @@ -7,10 +7,23 @@ var Router = Ember.Router.extend({ Router.map(function() { this.route('yarnApps'); + this.route('yarnNodes'); + this.route('yarnNode', { path: '/yarnNode/:node_id/:node_addr' }); + this.route('yarnNodeApps', { path: '/yarnNodeApps/:node_id/:node_addr' }); + this.route('yarnNodeApp', + { path: '/yarnNodeApp/:node_id/:node_addr/:app_id' }); + this.route('yarnNodeContainers', + { path: '/yarnNodeContainers/:node_id/:node_addr' }); + this.route('yarnNodeContainer', + { path: '/yarnNodeContainer/:node_id/:node_addr/:container_id' }); + this.route('yarnContainerLog', { path: + '/yarnContainerLog/:node_id/:node_addr/:container_id/:filename' }); this.route('yarnQueue', { path: '/yarnQueue/:queue_name' }); this.route('clusterOverview'); this.route('yarnApp', { path: '/yarnApp/:app_id' }); this.route('yarnAppAttempt', { path: '/yarnAppAttempt/:app_attempt_id'}); + this.route('error'); + this.route('notfound', { path: '*:' }); }); export default Router; http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js new file mode 100644 index 0000000..b7a5754 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/application.js @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +export default Ember.Route.extend({ + actions: { + /** + * Base error handler for the application. + * If specific routes do not handle the error, it will bubble up to + * this handler. Here we redirect to either 404 page or a generic + * error handler page. + */ + error: function (error) { + if (error && error.errors[0] && + error.errors[0].status == 404) { + this.intermediateTransitionTo('/notfound'); + } else { + this.intermediateTransitionTo('/error'); + } + } + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js new file mode 100644 index 0000000..b228ff4 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/index.js @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +export default Ember.Route.extend({ + /** + * Redirect root URL to cluster overview page. + */ + beforeModel: function() { + this.replaceWith('clusterOverview'); + } +}); + http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js index 79d184f..2787f5b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-apps.js @@ -2,7 +2,7 @@ import Ember from 'ember'; export default Ember.Route.extend({ model() { - var apps = this.store.findAll('yarnApp'); - return apps + var apps = this.store.findAll('yarnApp'); + return apps; } }); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js new file mode 100644 index 0000000..c324025 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-container-log.js @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; +import Constants from 'yarn-ui/constants'; + +export default Ember.Route.extend({ + model(param) { + var id = param.node_addr + Constants.PARAM_SEPARATOR + param.container_id + + Constants.PARAM_SEPARATOR + param.filename; + return Ember.RSVP.hash({ + containerLog: this.store.findRecord('yarnContainerLog', id), + nodeInfo: { id: param.node_id, addr: param.node_addr } + }).then(function(hash) { + // Just return as its success. + return hash; + }, function(reason) { + if (reason.errors && reason.errors[0]) { + // This means HTTP error response was sent by adapter. + return reason; + } else { + // Assume empty response received from server. + return { nodeInfo: { id: param.node_id, addr: param.node_addr }, + containerLog: { logs: "", containerID: param.container_id, + logFileName: param.filename}}; + } + }); + }, + + afterModel(model) { + // Handle errors and redirect if promise is rejected. + if (model.errors && model.errors[0]) { + if (model.errors[0].status == 404) { + this.replaceWith('/notfound'); + } else { + this.replaceWith('/error'); + } + } + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js new file mode 100644 index 0000000..63b1f2a --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-app.js @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +export default Ember.Route.extend({ + model(param) { + return Ember.RSVP.hash({ + nodeApp: this.store.queryRecord('yarnNodeApp', + { nodeAddr : param.node_addr, appId: param.app_id }), + nodeInfo: { id: param.node_id, addr: param.node_addr } + }); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js new file mode 100644 index 0000000..ffb5b7b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-apps.js @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +export default Ember.Route.extend({ + model(param) { + // Get all apps running on a specific node. Node is contacted by using node_addr. + return Ember.RSVP.hash({ + apps: this.store.query('yarnNodeApp', { nodeAddr: param.node_addr }), + nodeInfo: { id: param.node_id, addr: param.node_addr } + }); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js new file mode 100644 index 0000000..2022662 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-container.js @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +export default Ember.Route.extend({ + model(param) { + // Get a specific container running on a specific node. + return Ember.RSVP.hash({ + nodeContainer: this.store.queryRecord('yarnNodeContainer', + { nodeHttpAddr: param.node_addr, containerId: param.container_id }), + nodeInfo: { id: param.node_id, addr: param.node_addr } + }); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js new file mode 100644 index 0000000..9a69729 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node-containers.js @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model(param) { + // Get all containers running on specific node. + return Ember.RSVP.hash({ + containers: this.store.query('yarnNodeContainer', { nodeHttpAddr: param.node_addr }), + nodeInfo: { id: param.node_id, addr: param.node_addr } + }); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js new file mode 100644 index 0000000..7c58b94 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-node.js @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +export default Ember.Route.extend({ + model(param) { + // Fetches data from both NM and RM. RM is queried to get node usage info. + return Ember.RSVP.hash({ + node: this.store.findRecord('yarnNode', param.node_addr), + rmNode: this.store.findRecord('yarnRmNode', param.node_id) + }); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js new file mode 100644 index 0000000..f33eef8 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/routes/yarn-nodes.js @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +export default Ember.Route.extend({ + model() { + return this.store.findAll('yarnRmNode'); + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js new file mode 100644 index 0000000..9e10615 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-container-log.js @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; +import Converter from 'yarn-ui/utils/converter'; + +export default DS.JSONAPISerializer.extend({ + normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + // Convert plain text response into JSON. + // ID is of the form nodeAddress!containerId!fileName + var splits = Converter.splitForContainerLogs(id); + var convertedPayload = { + id: id, + type: primaryModelClass.modelName, + attributes: { + logs: payload, + containerID: splits[1], + logFileName: splits[2] + } + }; + return { data: convertedPayload }; + }, +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js new file mode 100644 index 0000000..8b1f152 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-app.js @@ -0,0 +1,86 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; +import Ember from 'ember'; + +export default DS.JSONAPISerializer.extend({ + internalNormalizeSingleResponse(store, primaryModelClass, payload) { + if (payload.app) { + payload = payload.app; + } + + var fixedPayload = { + id: payload.id, + type: primaryModelClass.modelName, + attributes: { + appId: payload.id, + state: payload.state, + user: payload.user, + containers: payload.containerids + } + }; + return fixedPayload; + }, + + normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + // payload is of the form {"app":{}} + var p = this.internalNormalizeSingleResponse(store, + primaryModelClass, payload); + return { data: p }; + }, + + normalizeArrayResponse(store, primaryModelClass, payload, id, + requestType) { + // expected return response is of the form { data: [ {}, {} ] } + var normalizedArrayResponse = {}; + // payload is of the form { "apps" : { "app": [ {},{},{} ] } } + if (payload.apps) { + normalizedArrayResponse.data = payload.apps.app.map(singleApp => { + return this.internalNormalizeSingleResponse(store, primaryModelClass, + singleApp); + }, this); + } else { + // No container reported inside containers. + // Response of the form { "apps": null } + normalizedArrayResponse.data = Ember.makeArray({ + id: "dummy", + type: primaryModelClass.modelName, + attributes: {}}); + } + return normalizedArrayResponse; + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js new file mode 100644 index 0000000..528f2fe --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node-container.js @@ -0,0 +1,74 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; +import Ember from 'ember'; + +export default DS.JSONAPISerializer.extend({ + internalNormalizeSingleResponse(store, primaryModelClass, payload) { + if (payload.container) { + payload = payload.container; + } + var fixedPayload = { + id: payload.id, + type: primaryModelClass.modelName, + attributes: { + containerId: payload.id, + state: payload.state, + user: payload.user, + diagnostics: payload.diagnostics, + exitCode: payload.exitCode, + totalMemoryNeeded: payload.totalMemoryNeededMB, + totalVCoresNeeded: payload.totalVCoresNeeded, + containerLogFiles: payload.containerLogFiles + } + }; + + return fixedPayload; + }, + + normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + // payload is of the form {"container":{}} + var p = this.internalNormalizeSingleResponse(store, + primaryModelClass, payload); + return { data: p }; + }, + + normalizeArrayResponse(store, primaryModelClass, payload, id, + requestType) { + // expected return response is of the form { data: [ {}, {} ] } + var normalizedArrayResponse = {}; + if (payload.containers) { + // payload is of the form { "containers" : { "container": [ {},{},{} ] } } + normalizedArrayResponse.data = + payload.containers.container.map(singleContainer => { + return this.internalNormalizeSingleResponse(store, primaryModelClass, + singleContainer); + }, this); + } else { + // No container reported inside containers. + // Response of the form { "containers": null } + normalizedArrayResponse.data = Ember.makeArray({ + id: "dummy", + type: primaryModelClass.modelName, + attributes: {}}); + } + return normalizedArrayResponse; + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js new file mode 100644 index 0000000..19308e2 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-node.js @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; +import Converter from 'yarn-ui/utils/converter'; + +export default DS.JSONAPISerializer.extend({ + internalNormalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + if (payload.nodeInfo) { + payload = payload.nodeInfo; + } + + var fixedPayload = { + id: id, + type: primaryModelClass.modelName, + attributes: { + totalVmemAllocatedContainersMB: payload.totalVmemAllocatedContainersMB, + totalPmemAllocatedContainersMB: payload.totalPmemAllocatedContainersMB, + totalVCoresAllocatedContainers: payload.totalVCoresAllocatedContainers, + vmemCheckEnabled: payload.vmemCheckEnabled, + pmemCheckEnabled: payload.pmemCheckEnabled, + nodeHealthy: payload.nodeHealthy, + lastNodeUpdateTime: Converter.timeStampToDate(payload.lastNodeUpdateTime), + healthReport: payload.healthReport, + nmStartupTime: Converter.timeStampToDate(payload.nmStartupTime), + nodeManagerBuildVersion: payload.nodeManagerBuildVersion, + hadoopBuildVersion: payload.hadoopBuildVersion + } + }; + return fixedPayload; + }, + + normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + // payload is of the form {"nodeInfo":{}} + var p = this.internalNormalizeSingleResponse(store, + primaryModelClass, payload, id, requestType); + return { data: p }; + }, +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js new file mode 100644 index 0000000..6cb9320 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-rm-node.js @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; +import DS from 'ember-data'; +import Converter from 'yarn-ui/utils/converter'; + +export default DS.JSONAPISerializer.extend({ + internalNormalizeSingleResponse(store, primaryModelClass, payload, id) { + if (payload.node) { + payload = payload.node; + } + + var fixedPayload = { + id: id, + type: primaryModelClass.modelName, + attributes: { + rack: payload.rack, + state: payload.state, + nodeHostName: payload.nodeHostName, + nodeHTTPAddress: payload.nodeHTTPAddress, + lastHealthUpdate: Converter.timeStampToDate(payload.lastHealthUpdate), + healthReport: payload.healthReport, + numContainers: payload.numContainers, + usedMemoryMB: payload.usedMemoryMB, + availMemoryMB: payload.availMemoryMB, + usedVirtualCores: payload.usedVirtualCores, + availableVirtualCores: payload.availableVirtualCores, + version: payload.version, + nodeLabels: payload.nodeLabels + } + }; + return fixedPayload; + }, + + normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + // payload is of the form {"nodeInfo":{}} + var p = this.internalNormalizeSingleResponse(store, + primaryModelClass, payload, id); + return { data: p }; + }, + + normalizeArrayResponse(store, primaryModelClass, payload, id, + requestType) { + // expected response is of the form { data: [ {}, {} ] } + var normalizedArrayResponse = {}; + if (payload.nodes) { + // payload is of the form { "nodes": { "node": [ {},{},{} ] } } + normalizedArrayResponse.data = payload.nodes.node.map(singleNode => { + return this.internalNormalizeSingleResponse(store, primaryModelClass, + singleNode, singleNode.id); + }, this); + } else { + normalizedArrayResponse.data = Ember.makeArray({ + id: "dummy", + type: primaryModelClass.modelName, + attributes: {}}); + } + return normalizedArrayResponse; + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/9a7488b6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs index 252ca74..a9de203 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/templates/application.hbs @@ -14,9 +14,7 @@
--------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org