Repository: tez Updated Branches: refs/heads/master af68ad875 -> 4dfb74fe0
TEZ-3556. Tez UI: Display query configurations (sree) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/4dfb74fe Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/4dfb74fe Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/4dfb74fe Branch: refs/heads/master Commit: 4dfb74fe00659a67042bff1d51ce9b6de5c0441a Parents: af68ad8 Author: Sreenath Somarajapuram <[email protected]> Authored: Wed Jan 18 18:32:51 2017 +0530 Committer: Sreenath Somarajapuram <[email protected]> Committed: Wed Jan 18 18:32:51 2017 +0530 ---------------------------------------------------------------------- CHANGES.txt | 1 + tez-ui/src/main/webapp/app/controllers/query.js | 3 + .../webapp/app/controllers/query/configs.js | 60 ++++++++++++++++++++ tez-ui/src/main/webapp/app/models/hive-query.js | 2 + tez-ui/src/main/webapp/app/router.js | 1 + tez-ui/src/main/webapp/app/routes/home/index.js | 4 +- .../src/main/webapp/app/routes/query/configs.js | 38 +++++++++++++ .../main/webapp/app/serializers/hive-query.js | 2 + .../main/webapp/app/templates/query/configs.hbs | 34 +++++++++++ .../webapp/tests/unit/controllers/query-test.js | 2 +- .../unit/controllers/query/configs-test.js | 55 ++++++++++++++++++ .../webapp/tests/unit/models/hive-query-test.js | 2 + .../tests/unit/routes/query/configs-test.js | 33 +++++++++++ .../tests/unit/serializers/hive-query-test.js | 2 +- 14 files changed, 236 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 4d97ab3..61c0459 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -166,6 +166,7 @@ ALL CHANGES: TEZ-3529. Tez UI: Add 'All Queries' table in the landing page along 'All DAGs' page TEZ-3530. Tez UI: Add query details page, and link the page from All Queries table TEZ-3531. Tez UI: All Queries table: Improve searchability + TEZ-3556. Tez UI: Display query configurations Release 0.8.5: Unreleased http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/app/controllers/query.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/controllers/query.js b/tez-ui/src/main/webapp/app/controllers/query.js index f872994..f9c6833 100644 --- a/tez-ui/src/main/webapp/app/controllers/query.js +++ b/tez-ui/src/main/webapp/app/controllers/query.js @@ -34,5 +34,8 @@ export default ParentController.extend({ tabs: [{ text: "Query Details", routeName: "query.index" + }, { + text: "Configurations", + routeName: "query.configs" }] }); http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/app/controllers/query/configs.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/controllers/query/configs.js b/tez-ui/src/main/webapp/app/controllers/query/configs.js new file mode 100644 index 0000000..8dcc91c --- /dev/null +++ b/tez-ui/src/main/webapp/app/controllers/query/configs.js @@ -0,0 +1,60 @@ +/*global more*/ +/** + * 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 TableController from '../table'; +import ColumnDefinition from 'em-table/utils/column-definition'; + +var MoreObject = more.Object; + +export default TableController.extend({ + searchText: "tez", + + breadcrumbs: [{ + text: "Configurations", + routeName: "app.configs", + }], + + columns: ColumnDefinition.make([{ + id: 'configName', + headerTitle: 'Configuration Name', + contentPath: 'configName', + }, { + id: 'configValue', + headerTitle: 'Configuration Value', + contentPath: 'configValue', + }]), + + configs: Ember.computed("model.configsJSON", function () { + var configs = JSON.parse(this.get("model.configsJSON")), + configRows = []; + + if(configs) { + MoreObject.forEach(configs, function (key, value) { + configRows.push(Ember.Object.create({ + configName: key, + configValue: value + })); + }); + } + + return Ember.A(configRows); + }) +}); http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/app/models/hive-query.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/models/hive-query.js b/tez-ui/src/main/webapp/app/models/hive-query.js index 3cb5063..7eac037 100644 --- a/tez-ui/src/main/webapp/app/models/hive-query.js +++ b/tez-ui/src/main/webapp/app/models/hive-query.js @@ -63,6 +63,8 @@ export default AbstractModel.extend({ status: DS.attr('string'), + configsJSON: DS.attr("string"), + startTime: DS.attr("number"), endTime: DS.attr("number"), duration: Ember.computed("startTime", "endTime", function () { http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/app/router.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/router.js b/tez-ui/src/main/webapp/app/router.js index 856e7b3..3444579 100644 --- a/tez-ui/src/main/webapp/app/router.js +++ b/tez-ui/src/main/webapp/app/router.js @@ -50,6 +50,7 @@ Router.map(function() { this.route('counters'); }); this.route('query', {path: '/query/:query_id'}, function() { + this.route('configs'); }); // Alias for backward compatibility with Tez UI V1 http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/app/routes/home/index.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/routes/home/index.js b/tez-ui/src/main/webapp/app/routes/home/index.js index dedbb92..92a93d8 100644 --- a/tez-ui/src/main/webapp/app/routes/home/index.js +++ b/tez-ui/src/main/webapp/app/routes/home/index.js @@ -84,7 +84,9 @@ export default ServerSideOpsRoute.extend({ records.forEach(function (record) { if(record.get("status") === "RUNNING") { that.get("loader").loadNeed(record, "am", {reload: true}).catch(function () { - record.set("am", null); + if(!record.get("isDeleted")) { + record.set("am", null); + } }); } }); http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/app/routes/query/configs.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/routes/query/configs.js b/tez-ui/src/main/webapp/app/routes/query/configs.js new file mode 100644 index 0000000..e7b5a49 --- /dev/null +++ b/tez-ui/src/main/webapp/app/routes/query/configs.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'; +import SingleAmPollsterRoute from '../single-am-pollster'; + +export default SingleAmPollsterRoute.extend({ + title: "Query Configurations", + + loaderNamespace: "query", + + canPoll: false, + + setupController: function (controller, model) { + this._super(controller, model); + Ember.run.later(this, "startCrumbBubble"); + }, + + load: function (value, query, options) { + var ID = this.modelFor("query").get("entityID"); + return this.get("loader").queryRecord('hive-query', ID, options); + }, +}); http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/app/serializers/hive-query.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/serializers/hive-query.js b/tez-ui/src/main/webapp/app/serializers/hive-query.js index 69f44bc..bd14368 100644 --- a/tez-ui/src/main/webapp/app/serializers/hive-query.js +++ b/tez-ui/src/main/webapp/app/serializers/hive-query.js @@ -75,6 +75,8 @@ export default TimelineSerializer.extend({ status: getStatus, + configsJSON: "otherinfo.CONF", + startTime: 'starttime', endTime: getEndTime, }, http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/app/templates/query/configs.hbs ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/templates/query/configs.hbs b/tez-ui/src/main/webapp/app/templates/query/configs.hbs new file mode 100644 index 0000000..62010e9 --- /dev/null +++ b/tez-ui/src/main/webapp/app/templates/query/configs.hbs @@ -0,0 +1,34 @@ +{{! + * 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. +}} + +{{#if loaded}} + {{em-table + columns=columns + rows=configs + + rowCount=configs.length + definition=definition + + enablePagination=false + + searchAction="searchChanged" + sortAction="sortChanged" + }} +{{else}} + {{partial "loading"}} +{{/if}} http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/tests/unit/controllers/query-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/controllers/query-test.js b/tez-ui/src/main/webapp/tests/unit/controllers/query-test.js index cbc2c96..de4452d 100644 --- a/tez-ui/src/main/webapp/tests/unit/controllers/query-test.js +++ b/tez-ui/src/main/webapp/tests/unit/controllers/query-test.js @@ -31,7 +31,7 @@ test('Basic creation test', function(assert) { }); assert.ok(controller); - assert.ok(controller.tabs.length, 1); + assert.equal(controller.get("tabs.length"), 2); }); test('breadcrumbs test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/tests/unit/controllers/query/configs-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/controllers/query/configs-test.js b/tez-ui/src/main/webapp/tests/unit/controllers/query/configs-test.js new file mode 100644 index 0000000..44981b1 --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/controllers/query/configs-test.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 { moduleFor, test } from 'ember-qunit'; + +moduleFor('controller:query/configs', 'Unit | Controller | query/configs', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let controller = this.subject({ + send: Ember.K, + initVisibleColumns: Ember.K + }); + + assert.ok(controller); + assert.equal(controller.get("searchText"), "tez"); + assert.equal(controller.get("breadcrumbs.length"), 1); + assert.equal(controller.get("columns.length"), 2); +}); + +test('Basic creation test', function(assert) { + let controller = this.subject({ + send: Ember.K, + initVisibleColumns: Ember.K, + model: { + configsJSON: JSON.stringify({ + x: 1 + }) + } + }); + + let configs = controller.get("configs"); + + assert.equal(configs.length, 1); + assert.equal(configs[0].configName, "x"); + assert.equal(configs[0].configValue, 1); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js b/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js index f081907..5c7b492 100644 --- a/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js +++ b/tez-ui/src/main/webapp/tests/unit/models/hive-query-test.js @@ -41,6 +41,8 @@ test('Basic creation test', function(assert) { assert.ok(model.queryText); + assert.ok(model.configsJSON); + assert.ok(model.startTime); assert.ok(model.endTime); assert.ok(model.duration); http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/tests/unit/routes/query/configs-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/routes/query/configs-test.js b/tez-ui/src/main/webapp/tests/unit/routes/query/configs-test.js new file mode 100644 index 0000000..883ad74 --- /dev/null +++ b/tez-ui/src/main/webapp/tests/unit/routes/query/configs-test.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 { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:query/configs', 'Unit | Route | query/configs', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('Basic creation test', function(assert) { + let route = this.subject(); + + assert.ok(route); + assert.equal(route.get("loaderNamespace"), "query"); + assert.ok(route.get("setupController")); + assert.ok(route.get("load")); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/4dfb74fe/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js index 7771930..c4cf130 100644 --- a/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js +++ b/tez-ui/src/main/webapp/tests/unit/serializers/hive-query-test.js @@ -26,7 +26,7 @@ moduleFor('serializer:hive-query', 'Unit | Serializer | hive query', { test('Basic creation test', function(assert) { let serializer = this.subject(); - assert.equal(Object.keys(serializer.get("maps")).length, 6 + 19); + assert.equal(Object.keys(serializer.get("maps")).length, 6 + 20); assert.ok(serializer.get("extractAttributes")); });
