TEZ-3503. Tez UI: Support search by queue name (sree)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/d40f3ad7 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/d40f3ad7 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/d40f3ad7 Branch: refs/heads/TEZ-1190 Commit: d40f3ad719e6713d4b1dbf1dc1e9646f79f21c3d Parents: af0d4d7 Author: Sreenath Somarajapuram <[email protected]> Authored: Tue Mar 7 17:12:52 2017 +0530 Committer: Sreenath Somarajapuram <[email protected]> Committed: Tue Mar 7 17:12:52 2017 +0530 ---------------------------------------------------------------------- CHANGES.txt | 1 + tez-ui/src/main/webapp/app/adapters/timeline.js | 1 + .../webapp/app/components/dags-page-search.js | 2 ++ .../main/webapp/app/controllers/home/index.js | 23 ++++++++++++++---- tez-ui/src/main/webapp/app/entities/entity.js | 4 ++++ tez-ui/src/main/webapp/app/models/dag.js | 10 ++++++-- tez-ui/src/main/webapp/app/routes/home/index.js | 5 +++- tez-ui/src/main/webapp/app/serializers/dag.js | 4 +++- .../webapp/app/styles/dags-page-search.less | 4 ++-- .../templates/components/dags-page-search.hbs | 8 +++++++ .../src/main/webapp/app/templates/dag/index.hbs | 4 ++++ .../main/webapp/app/templates/home/index.hbs | 5 ++++ tez-ui/src/main/webapp/package.json | 2 +- .../components/dags-page-search-test.js | 4 ++-- .../webapp/tests/unit/adapters/timeline-test.js | 2 +- .../tests/unit/controllers/home/index-test.js | 16 +++++++++++++ .../webapp/tests/unit/entities/entity-test.js | 25 ++++++++++++++++++++ .../main/webapp/tests/unit/models/dag-test.js | 18 ++++++++++++++ .../webapp/tests/unit/routes/home/index-test.js | 2 +- .../webapp/tests/unit/serializers/dag-test.js | 2 ++ 20 files changed, 127 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 1d2af07..248f329 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -215,6 +215,7 @@ ALL CHANGES: TEZ-3639. Tez UI: Footer pagination is improper in landing page TEZ-3640. Tez UI: Add associated llap application id to queries page TEZ-3642. Tez UI: Auto-refresh is not stopping when DAG is the main entity + TEZ-3503. Tez UI: Support search by queue name Release 0.8.5: Unreleased http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/adapters/timeline.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/adapters/timeline.js b/tez-ui/src/main/webapp/app/adapters/timeline.js index 41cbd1c..2d8f474 100644 --- a/tez-ui/src/main/webapp/app/adapters/timeline.js +++ b/tez-ui/src/main/webapp/app/adapters/timeline.js @@ -41,6 +41,7 @@ export default AbstractAdapter.extend({ requestuser: "requestuser", executionMode: "executionmode", callerId: "callerId", + queueName: "queueName", tablesRead: "tablesread", tablesWritten: "tableswritten", http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/components/dags-page-search.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/components/dags-page-search.js b/tez-ui/src/main/webapp/app/components/dags-page-search.js index f1cc71b..0adbf84 100644 --- a/tez-ui/src/main/webapp/app/components/dags-page-search.js +++ b/tez-ui/src/main/webapp/app/components/dags-page-search.js @@ -27,6 +27,7 @@ export default Ember.Component.extend({ status: Ember.computed.oneWay("tableDefinition.status"), appID: Ember.computed.oneWay("tableDefinition.appID"), callerID: Ember.computed.oneWay("tableDefinition.callerID"), + queue: Ember.computed.oneWay("tableDefinition.queue"), sendSearch: function () { this.get('parentView').sendAction('search', { @@ -36,6 +37,7 @@ export default Ember.Component.extend({ status: this.get("status"), appID: this.get("appID"), callerID: this.get("callerID"), + queue: this.get("queue"), }); }, http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/controllers/home/index.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/controllers/home/index.js b/tez-ui/src/main/webapp/app/controllers/home/index.js index 9194fd6..74050e3 100644 --- a/tez-ui/src/main/webapp/app/controllers/home/index.js +++ b/tez-ui/src/main/webapp/app/controllers/home/index.js @@ -24,13 +24,16 @@ import TableDefinition from 'em-table/utils/table-definition'; export default TableController.extend({ - queryParams: ["dagName", "dagID", "submitter", "status", "appID", "callerID", "appid", "id", "user", "dag_name"], + queryParams: ["dagName", "dagID", "submitter", "status", "appID", "callerID", "queue", + "appid", "id", "user", "dag_name"], dagName: "", dagID: "", submitter: "", status: "", appID: "", callerID: "", + queue: "", + appid: "", id: "", user: "", @@ -53,8 +56,8 @@ export default TableController.extend({ _definition: TableDefinition.create(), // Using computed, as observer won't fire if the property is not used - definition: Ember.computed("dagName", "dagID", "submitter", "status", - "appID", "callerID", "pageNum", "moreAvailable", "loadingMore", function () { + definition: Ember.computed("dagName", "dagID", "submitter", "status", "appID", "callerID", "queue", + "pageNum", "moreAvailable", "loadingMore", function () { var definition = this.get("_definition"); if (!this.get("appID")) { @@ -81,6 +84,7 @@ export default TableController.extend({ status: this.get("status"), appID: this.get("appID"), callerID: this.get("callerID"), + queue: this.get("queue"), pageNum: this.get("pageNum"), @@ -155,7 +159,18 @@ export default TableController.extend({ },{ id: 'queue', headerTitle: 'Queue', - contentPath: 'queue' + contentPath: 'queue', + observePath: true, + getCellContent: function (row) { + var queueName = row.get("queue"); + if(!row.get("queueName") && row.get("app.queue")) { + return { + comment: "Queue name for this row was loaded separately, and will not be searchable!", + content: queueName + }; + } + return queueName; + } },{ id: 'callerID', headerTitle: 'Caller ID', http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/entities/entity.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/entities/entity.js b/tez-ui/src/main/webapp/app/entities/entity.js index d982811..c8f602b 100644 --- a/tez-ui/src/main/webapp/app/entities/entity.js +++ b/tez-ui/src/main/webapp/app/entities/entity.js @@ -187,6 +187,10 @@ var Entity = Ember.Object.extend(NameMixin, { MoreObject.forEach(needs, function (name, needOptions) { needOptions = that.normalizeNeed(name, needOptions, parentModel, queryParams, urlParams); + if(MoreObject.isFunction(needOptions.loadType)) { + needOptions.loadType = needOptions.loadType.call(needOptions, parentModel); + } + if(needOptions.loadType !== "demand") { let needLoader = that._loadNeed(loader, parentModel, needOptions, options); http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/models/dag.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/models/dag.js b/tez-ui/src/main/webapp/app/models/dag.js index 5e011e2..7e57615 100644 --- a/tez-ui/src/main/webapp/app/models/dag.js +++ b/tez-ui/src/main/webapp/app/models/dag.js @@ -43,6 +43,11 @@ export default AMTimelineModel.extend({ app: { type: ["AhsApp", "appRm"], idKey: "appID", + loadType: function (record) { + if(record.get("queueName")) { + return "demand"; + } + }, silent: true } }, @@ -58,8 +63,9 @@ export default AMTimelineModel.extend({ domain: DS.attr("string"), containerLogs: DS.attr("object"), - queue: Ember.computed("app", function () { - return this.get("app.queue"); + queueName: DS.attr("string"), + queue: Ember.computed("queueName", "app", function () { + return this.get("queueName") || this.get("app.queue"); }), vertexIdNameMap: DS.attr("object"), http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/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 92a93d8..0cdcc7c 100644 --- a/tez-ui/src/main/webapp/app/routes/home/index.js +++ b/tez-ui/src/main/webapp/app/routes/home/index.js @@ -32,6 +32,7 @@ export default ServerSideOpsRoute.extend({ status: REFRESH, appID: REFRESH, callerID: REFRESH, + queue: REFRESH, rowCount: REFRESH }, @@ -43,6 +44,7 @@ export default ServerSideOpsRoute.extend({ status: "status", appID: "appID", callerID: "callerID", + queueName: "queue", limit: "rowCount", }, @@ -63,7 +65,8 @@ export default ServerSideOpsRoute.extend({ submitter: query.submitter, status: query.status, appID: query.appID, - callerID: query.callerID + callerID: query.callerID, + queue: query.queueName }; return records.filter(function (record) { http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/serializers/dag.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/serializers/dag.js b/tez-ui/src/main/webapp/app/serializers/dag.js index bf31174..04dbdd2 100644 --- a/tez-ui/src/main/webapp/app/serializers/dag.js +++ b/tez-ui/src/main/webapp/app/serializers/dag.js @@ -121,7 +121,9 @@ export default TimelineSerializer.extend({ // appID domain: 'domain', - // queue + + queueName: 'otherinfo.queueName', + containerLogs: getContainerLogs, vertexIdNameMap: getIdNameMap, http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/styles/dags-page-search.less ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/styles/dags-page-search.less b/tez-ui/src/main/webapp/app/styles/dags-page-search.less index 5fc3cfb..fe37b84 100644 --- a/tez-ui/src/main/webapp/app/styles/dags-page-search.less +++ b/tez-ui/src/main/webapp/app/styles/dags-page-search.less @@ -41,7 +41,7 @@ .search-element { display: inline-block; - width: 16.66%; + width: 14.25%; vertical-align: top; @@ -67,7 +67,7 @@ @media screen and (min-width: 1300px) { .dags-page-search{ float: left; - width: 70%; + width: 75%; .form-group { margin-bottom: 0px; http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/templates/components/dags-page-search.hbs ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/templates/components/dags-page-search.hbs b/tez-ui/src/main/webapp/app/templates/components/dags-page-search.hbs index 60a0958..7def955 100644 --- a/tez-ui/src/main/webapp/app/templates/components/dags-page-search.hbs +++ b/tez-ui/src/main/webapp/app/templates/components/dags-page-search.hbs @@ -63,6 +63,14 @@ enter="search" }} </div><div class="search-element"> + <label for="pwd">Queue:</label> + {{input value=queue + type="text" + class="form-control input-sm" + placeholder="Search..." + enter="search" + }} + </div><div class="search-element"> <label for="pwd">Caller ID:</label> {{input value=callerID type="text" http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/templates/dag/index.hbs ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/templates/dag/index.hbs b/tez-ui/src/main/webapp/app/templates/dag/index.hbs index 4876b58..ad1e093 100644 --- a/tez-ui/src/main/webapp/app/templates/dag/index.hbs +++ b/tez-ui/src/main/webapp/app/templates/dag/index.hbs @@ -70,6 +70,10 @@ <td>{{txt model.duration type="duration"}}</td> </tr> <tr> + <td>Queue</td> + <td>{{txt model.queue}}</td> + </tr> + <tr> <td>Logs</td> <td> {{em-table-linked-cell content=model.containerLogs definition=logLinkDefinition}} http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/app/templates/home/index.hbs ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/templates/home/index.hbs b/tez-ui/src/main/webapp/app/templates/home/index.hbs index fe18266..e6f3aa0 100644 --- a/tez-ui/src/main/webapp/app/templates/home/index.hbs +++ b/tez-ui/src/main/webapp/app/templates/home/index.hbs @@ -36,6 +36,11 @@ loadPage="loadPage" reload="reload" }} + {{#if queue}} + <div class="alert alert-info"> + <strong>Info!</strong> Searching on Queue Name is supported only form <strong>Tez 0.9.0</strong>. So DAGs created by older versions of Tez will not be available! + </div> + {{/if}} {{else}} {{partial "loading"}} {{/if}} http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/package.json ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/package.json b/tez-ui/src/main/webapp/package.json index 8985f82..d85766b 100644 --- a/tez-ui/src/main/webapp/package.json +++ b/tez-ui/src/main/webapp/package.json @@ -58,7 +58,7 @@ }, "dependencies": { "em-helpers": "0.8.0", - "em-table": "0.6.0", + "em-table": "0.7.2", "em-tgraph": "0.0.10" } } http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/tests/integration/components/dags-page-search-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/integration/components/dags-page-search-test.js b/tez-ui/src/main/webapp/tests/integration/components/dags-page-search-test.js index def7413..d9912eb 100644 --- a/tez-ui/src/main/webapp/tests/integration/components/dags-page-search-test.js +++ b/tez-ui/src/main/webapp/tests/integration/components/dags-page-search-test.js @@ -30,7 +30,7 @@ test('Basic creation test', function(assert) { this.render(hbs`{{dags-page-search}}`); - assert.equal(this.$("input").length, 5); + assert.equal(this.$("input").length, 6); assert.equal(this.$("select").length, 1); // Template block usage:" + EOL + @@ -40,6 +40,6 @@ test('Basic creation test', function(assert) { {{/dags-page-search}} `); - assert.equal(this.$("input").length, 5); + assert.equal(this.$("input").length, 6); assert.equal(this.$("select").length, 1); }); http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/tests/unit/adapters/timeline-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/adapters/timeline-test.js b/tez-ui/src/main/webapp/tests/unit/adapters/timeline-test.js index c7eab39..8f8fef6 100644 --- a/tez-ui/src/main/webapp/tests/unit/adapters/timeline-test.js +++ b/tez-ui/src/main/webapp/tests/unit/adapters/timeline-test.js @@ -37,7 +37,7 @@ test('Basic creation test', function(assert) { test('filters test', function(assert) { let filters = this.subject().filters; - assert.equal(Object.keys(filters).length, 6 + 7 + 4); + assert.equal(Object.keys(filters).length, 6 + 8 + 4); }); test('stringifyFilters test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js b/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js index 579cc76..a9e5ac1 100644 --- a/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js +++ b/tez-ui/src/main/webapp/tests/unit/controllers/home/index-test.js @@ -56,6 +56,17 @@ test('Basic creation test', function(assert) { assert.ok(controller.actions.pageChanged); }); +test('queryParams test', function(assert) { + let controller = this.subject({ + initVisibleColumns: Ember.K, + beforeSort: {bind: Ember.K}, + send: Ember.K + }); + + // 11 New, 5 Inherited & 4 for backward compatibility + assert.equal(controller.get("queryParams.length"), 7 + 5 + 4); +}); + test('definition test', function(assert) { let controller = this.subject({ initVisibleColumns: Ember.K, @@ -69,6 +80,7 @@ test('definition test', function(assert) { testStatus = "Status", testAppID = "AppID", testCallerID = "CallerID", + testQueue = "Queue", testPageNum = 10, testMoreAvailable = true, testLoadingMore = true; @@ -79,6 +91,7 @@ test('definition test', function(assert) { assert.equal(definition.get("status"), ""); assert.equal(definition.get("appID"), ""); assert.equal(definition.get("callerID"), ""); + assert.equal(definition.get("queue"), ""); assert.equal(definition.get("pageNum"), 1); @@ -104,6 +117,9 @@ test('definition test', function(assert) { controller.set("callerID", testCallerID); assert.equal(controller.get("definition.callerID"), testCallerID); + controller.set("queue", testQueue); + assert.equal(controller.get("definition.queue"), testQueue); + controller.set("pageNum", testPageNum); assert.equal(controller.get("definition.pageNum"), testPageNum); http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js b/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js index 1e353f0..57aad9f 100644 --- a/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js +++ b/tez-ui/src/main/webapp/tests/unit/entities/entity-test.js @@ -230,6 +230,31 @@ test('setNeed test', function(assert) { assert.equal(parentModel.get(testName), undefined); }); +test('loadAllNeeds loadType=function test', function(assert) { + var entity = this.subject(), + loader = {}, + testRecord = Ember.Object.create({ + refreshLoadTime: Ember.K, + needs: { + app: { + idKey: "appID", + loadType: function (record) { + assert.ok(testRecord === record); + return "demand"; + } + }, + }, + appID: 1, + }); + + entity._loadNeed = function () { + assert.ok(true); // Shouldn't be called + }; + + assert.expect(1 + 1); + assert.equal(entity.loadAllNeeds(loader, testRecord), undefined); +}); + test('_loadNeed single string type test', function(assert) { let entity = this.subject(), loader, http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/tests/unit/models/dag-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/models/dag-test.js b/tez-ui/src/main/webapp/tests/unit/models/dag-test.js index 2c07f7b..a219cf8 100644 --- a/tez-ui/src/main/webapp/tests/unit/models/dag-test.js +++ b/tez-ui/src/main/webapp/tests/unit/models/dag-test.js @@ -58,3 +58,21 @@ test('Basic creation test', function(assert) { assert.ok(model.amWsVersion); }); + +test('queue test', function(assert) { + let model = this.subject(), + queueName = "queueName", + appQueueName = "AppQueueName"; + + assert.equal(model.get("queue"), undefined); + + Ember.run(function () { + model.set("app", { + queue: appQueueName + }); + assert.equal(model.get("queue"), appQueueName); + + model.set("queueName", queueName); + assert.equal(model.get("queue"), queueName); + }); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js b/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js index 99d7cf6..d35a325 100644 --- a/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js +++ b/tez-ui/src/main/webapp/tests/unit/routes/home/index-test.js @@ -56,7 +56,7 @@ test('refresh test', function(assert) { test('loaderQueryParams test', function(assert) { let route = this.subject(); - assert.equal(Object.keys(route.get("loaderQueryParams")).length, 7); + assert.equal(Object.keys(route.get("loaderQueryParams")).length, 8); }); test('filterRecords test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/d40f3ad7/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js index 7df4084..e782869 100644 --- a/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js +++ b/tez-ui/src/main/webapp/tests/unit/serializers/dag-test.js @@ -35,6 +35,8 @@ test('Basic creation test', function(assert) { assert.ok(serializer.maps.endTime); assert.ok(serializer.maps.containerLogs); assert.ok(serializer.maps.vertexIdNameMap); + + assert.equal(Object.keys(serializer.get("maps")).length, 18 + 5); //18 own & 7 inherited }); test('atsStatus test', function(assert) {
