TEZ-2916. Tez UI 2: Show counts of running tasks on the DAG visualization page (sree)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/9cb1da43 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/9cb1da43 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/9cb1da43 Branch: refs/heads/TEZ-2980 Commit: 9cb1da43b2bbe7d13a195c3d617638ee5edb8d21 Parents: 32bcb39 Author: Sreenath Somarajapuram <s...@apache.org> Authored: Wed Feb 17 15:59:56 2016 +0530 Committer: Sreenath Somarajapuram <s...@apache.org> Committed: Thu Feb 25 03:32:53 2016 +0530 ---------------------------------------------------------------------- TEZ-2980-CHANGES.txt | 1 + .../webapp/app/controllers/dag/graphical.js | 15 +++++++ .../main/webapp/app/controllers/dag/vertices.js | 36 +++++++++++++++- .../src/main/webapp/app/controllers/table.js | 2 +- .../tests/unit/controllers/dag/vertices-test.js | 43 ++++++++++++++++++++ 5 files changed, 95 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/9cb1da43/TEZ-2980-CHANGES.txt ---------------------------------------------------------------------- diff --git a/TEZ-2980-CHANGES.txt b/TEZ-2980-CHANGES.txt index 9d949ca..512492b 100644 --- a/TEZ-2980-CHANGES.txt +++ b/TEZ-2980-CHANGES.txt @@ -36,3 +36,4 @@ ALL CHANGES: TEZ-3092. Tez UI 2: Tuneups & Improvements TEZ-3095. Tez UI 2: Tuneups & Improvements TEZ-3088. Tez UI 2: Licenses of all the packages used by Tez Ui must be documented + TEZ-2916. Tez UI 2: Show counts of running tasks on the DAG visualization page http://git-wip-us.apache.org/repos/asf/tez/blob/9cb1da43/tez-ui2/src/main/webapp/app/controllers/dag/graphical.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/dag/graphical.js b/tez-ui2/src/main/webapp/app/controllers/dag/graphical.js index 86d534a..470628c 100644 --- a/tez-ui2/src/main/webapp/app/controllers/dag/graphical.js +++ b/tez-ui2/src/main/webapp/app/controllers/dag/graphical.js @@ -85,6 +85,21 @@ export default MultiTableController.extend({ headerTitle: 'Tasks', contentPath: 'totalTasks', },{ + id: 'succeededTasks', + headerTitle: 'Succeeded Tasks', + contentPath: 'succeededTasks', + observePath: true + },{ + id: 'runningTasks', + headerTitle: 'Running Tasks', + contentPath: 'runningTasks', + observePath: true + },{ + id: 'pendingTasks', + headerTitle: 'Pending Tasks', + contentPath: 'pendingTasks', + observePath: true + },{ id: 'processorClassName', headerTitle: 'Processor Class', contentPath: 'processorClassName', http://git-wip-us.apache.org/repos/asf/tez/blob/9cb1da43/tez-ui2/src/main/webapp/app/controllers/dag/vertices.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/dag/vertices.js b/tez-ui2/src/main/webapp/app/controllers/dag/vertices.js index f42a667..306d606 100644 --- a/tez-ui2/src/main/webapp/app/controllers/dag/vertices.js +++ b/tez-ui2/src/main/webapp/app/controllers/dag/vertices.js @@ -80,9 +80,43 @@ export default MultiTableController.extend({ headerTitle: 'Tasks', contentPath: 'totalTasks', },{ + id: 'succeededTasks', + headerTitle: 'Succeeded Tasks', + contentPath: 'succeededTasks', + observePath: true + },{ + id: 'runningTasks', + headerTitle: 'Running Tasks', + contentPath: 'runningTasks', + observePath: true + },{ + id: 'pendingTasks', + headerTitle: 'Pending Tasks', + contentPath: 'pendingTasks', + observePath: true + },{ id: 'processorClassName', headerTitle: 'Processor Class', contentPath: 'processorClassName', - }]) + }]), + + beforeSort: function (columnDefinition) { + if(this._super(columnDefinition)) { + if(this.get("polling.isReady")) { + let columnName = columnDefinition.get("headerTitle"); + switch(columnDefinition.get("contentPath")) { + case "succeededTasks": + case "runningTasks": + case "pendingTasks": + this.send("openModal", { + title: "Cannot sort!", + content: `Sorting on ${columnName} is disabled for running DAGs!` + }); + return false; + } + } + } + return true; + } }); http://git-wip-us.apache.org/repos/asf/tez/blob/9cb1da43/tez-ui2/src/main/webapp/app/controllers/table.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/table.js b/tez-ui2/src/main/webapp/app/controllers/table.js index ca2bae8..f0bce1c 100644 --- a/tez-ui2/src/main/webapp/app/controllers/table.js +++ b/tez-ui2/src/main/webapp/app/controllers/table.js @@ -45,7 +45,7 @@ export default AbstractController.extend({ polling: Ember.inject.service("pollster"), - definition: Ember.computed(function () { + definition: Ember.computed("model", function () { return TableDefinition.create({ rowCount: this.get("rowCount"), searchText: this.get("searchText"), http://git-wip-us.apache.org/repos/asf/tez/blob/9cb1da43/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js index fa7bec0..0c5f766 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/dag/vertices-test.js @@ -38,4 +38,47 @@ test('Basic creation test', function(assert) { assert.ok(controller); assert.ok(controller.breadcrumbs); assert.ok(controller.columns); + assert.ok(controller.beforeSort); +}); + +test('beforeSort test', function(assert) { + let controller = this.subject({ + initVisibleColumns: Ember.K, + getCounterColumns: function () { + return []; + }, + polling: { + isReady: true + }, + send: function (actionName) { + if(actionName === "openModal") { + assert.ok(true); + } + } + }); + + // Bind poilyfill + Function.prototype.bind = function (context) { + var that = this; + return function (val) { + return that.call(context, val); + }; + }; + + assert.expect(1 + 3 + 3); + + assert.ok(controller.beforeSort(Ember.Object.create({ + contentPath: "NonDisabledColumn" + })), "NonDisabledColumn"); + + assert.notOk(controller.beforeSort(Ember.Object.create({ + contentPath: "succeededTasks" + })), "succeededTasks"); + assert.notOk(controller.beforeSort(Ember.Object.create({ + contentPath: "runningTasks" + })), "runningTasks"); + assert.notOk(controller.beforeSort(Ember.Object.create({ + contentPath: "pendingTasks" + })), "pendingTasks"); + });