You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by sr...@apache.org on 2016/02/18 10:12:39 UTC
tez git commit: TEZ-3125. Tez UI 2: All auto-refresh pages refresh
multiple times shortly after application complete (sree)
Repository: tez
Updated Branches:
refs/heads/TEZ-2980 bff263655 -> d83904453
TEZ-3125. Tez UI 2: All auto-refresh pages refresh multiple times shortly after application complete (sree)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/d8390445
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/d8390445
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/d8390445
Branch: refs/heads/TEZ-2980
Commit: d83904453497de7e8f186acd9dab874a9870a5d0
Parents: bff2636
Author: Sreenath Somarajapuram <sr...@apache.org>
Authored: Thu Feb 18 14:42:09 2016 +0530
Committer: Sreenath Somarajapuram <sr...@apache.org>
Committed: Thu Feb 18 14:42:09 2016 +0530
----------------------------------------------------------------------
TEZ-2980-CHANGES.txt | 1 +
.../main/webapp/app/controllers/app/index.js | 1 -
tez-ui2/src/main/webapp/app/entities/entity.js | 35 ++++++--
tez-ui2/src/main/webapp/app/models/app.js | 8 ++
tez-ui2/src/main/webapp/app/models/dag.js | 5 ++
tez-ui2/src/main/webapp/app/models/timeline.js | 2 +-
.../src/main/webapp/app/routes/am-pollster.js | 9 +-
tez-ui2/src/main/webapp/app/routes/dags.js | 4 +-
.../src/main/webapp/app/templates/app/index.hbs | 8 +-
.../webapp/tests/unit/entities/entity-test.js | 94 ++++++++++++++++++++
.../tests/unit/routes/am-pollster-test.js | 1 +
11 files changed, 151 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/TEZ-2980-CHANGES.txt
----------------------------------------------------------------------
diff --git a/TEZ-2980-CHANGES.txt b/TEZ-2980-CHANGES.txt
index 512492b..949dcb6 100644
--- a/TEZ-2980-CHANGES.txt
+++ b/TEZ-2980-CHANGES.txt
@@ -37,3 +37,4 @@ ALL CHANGES:
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
+ TEZ-3125. Tez UI 2: All auto-refresh pages refresh multiple times shortly after application complete
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/app/controllers/app/index.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/controllers/app/index.js b/tez-ui2/src/main/webapp/app/controllers/app/index.js
index cf199f8..7f7bc78 100644
--- a/tez-ui2/src/main/webapp/app/controllers/app/index.js
+++ b/tez-ui2/src/main/webapp/app/controllers/app/index.js
@@ -22,7 +22,6 @@ import PageController from '../page';
export default PageController.extend({
trackingURL: Ember.computed("model.appID", function () {
- console.log(this.get("hosts.rm"));
return [
this.get("hosts.rm"),
this.get("env.app.namespaces.web.rm"),
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/app/entities/entity.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/entities/entity.js b/tez-ui2/src/main/webapp/app/entities/entity.js
index 8280558..462a148 100644
--- a/tez-ui2/src/main/webapp/app/entities/entity.js
+++ b/tez-ui2/src/main/webapp/app/entities/entity.js
@@ -88,27 +88,46 @@ var Entity = Ember.Object.extend(NameMixin, {
return Ember.Object.create(need, overrides);
},
- _loadNeed: function (loader, parentModel, needOptions, options) {
- var needLoader = loader.queryRecord(
- needOptions.type,
+ _loadNeed: function (loader, parentModel, needOptions, options, index) {
+ var needLoader,
+ that = this,
+ types = needOptions.type,
+ type;
+
+ if(!Array.isArray(types)) {
+ types = [types];
+ }
+
+ index = index || 0;
+ type = types[index];
+
+ needLoader = loader.queryRecord(
+ type,
parentModel.get(needOptions.idKey),
options,
needOptions.queryParams,
needOptions.urlParams
);
- needLoader.then(function (model) {
+ needLoader = needLoader.then(function (model) {
parentModel.set(needOptions.name, model);
parentModel.refreshLoadTime();
return model;
});
- if(needOptions.silent) {
- needLoader = needLoader.catch(function () {
+ needLoader = needLoader.catch(function (err) {
+ if(++index < types.length) {
+ return that._loadNeed(loader, parentModel, needOptions, options, index);
+ }
+
+ if(needOptions.silent) {
parentModel.set(needOptions.name, null);
parentModel.refreshLoadTime();
- });
- }
+ }
+ else {
+ throw(err);
+ }
+ });
return needLoader;
},
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/app/models/app.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/models/app.js b/tez-ui2/src/main/webapp/app/models/app.js
index 6dcedd1..eabb61f 100644
--- a/tez-ui2/src/main/webapp/app/models/app.js
+++ b/tez-ui2/src/main/webapp/app/models/app.js
@@ -22,6 +22,14 @@ import DS from 'ember-data';
import TimelineModel from './timeline';
export default TimelineModel.extend({
+ needs:{
+ app: {
+ type: ["AhsApp", "appRm"],
+ idKey: "appID",
+ silent: true
+ }
+ },
+
appID: Ember.computed("entityID", function () {
return this.get("entityID").substr(4);
}),
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/app/models/dag.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/models/dag.js b/tez-ui2/src/main/webapp/app/models/dag.js
index 7114a7c..8e7b523 100644
--- a/tez-ui2/src/main/webapp/app/models/dag.js
+++ b/tez-ui2/src/main/webapp/app/models/dag.js
@@ -38,6 +38,11 @@ export default AMTimelineModel.extend({
app_id: model.get("appID")
};
}
+ },
+ app: {
+ type: ["AhsApp", "appRm"],
+ idKey: "appID",
+ silent: true
}
},
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/app/models/timeline.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/models/timeline.js b/tez-ui2/src/main/webapp/app/models/timeline.js
index ca82193..a739ec4 100644
--- a/tez-ui2/src/main/webapp/app/models/timeline.js
+++ b/tez-ui2/src/main/webapp/app/models/timeline.js
@@ -25,7 +25,7 @@ export default AbstractModel.extend({
needs:{
app: {
- type: "AhsApp",
+ type: ["appRm", "AhsApp"],
idKey: "appID",
silent: true
}
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/app/routes/am-pollster.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/routes/am-pollster.js b/tez-ui2/src/main/webapp/app/routes/am-pollster.js
index 35d6611..e26c0aa 100644
--- a/tez-ui2/src/main/webapp/app/routes/am-pollster.js
+++ b/tez-ui2/src/main/webapp/app/routes/am-pollster.js
@@ -44,17 +44,22 @@ export default PollsterRoute.extend({
this.get("loader").queryRecord("appRm", record.get("appID"), {reload: true}).then(function (appRm) {
if(appRm.get('isComplete')) {
- that.reload();
+ that.scheduleReload();
}
else {
that.send("error", error);
}
}, function (error) {
that.send("error", error);
- Ember.run.later(that, "reload", that.get("polling.interval") * 3);
+ that.scheduleReload();
});
},
+ scheduleReload: function () {
+ this.set("polledRecords", null);
+ Ember.run.debounce(this, "reload", this.get("polling.interval") * 2);
+ },
+
reload: function () {
this.set("polledRecords", null);
this.send("reload");
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/app/routes/dags.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/routes/dags.js b/tez-ui2/src/main/webapp/app/routes/dags.js
index 4902460..ebbbe92 100644
--- a/tez-ui2/src/main/webapp/app/routes/dags.js
+++ b/tez-ui2/src/main/webapp/app/routes/dags.js
@@ -93,7 +93,9 @@ export default AbstractRoute.extend({
records = that.filterRecords(records, query);
records.forEach(function (record) {
if(record.get("status") === "RUNNING") {
- that.get("loader").loadNeed(record, "am", {reload: true});
+ that.get("loader").loadNeed(record, "am", {reload: true}).catch(function () {
+ record.set("am", null);
+ });
}
});
return records;
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/app/templates/app/index.hbs
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/templates/app/index.hbs b/tez-ui2/src/main/webapp/app/templates/app/index.hbs
index bf77bf1..2c04d2c 100644
--- a/tez-ui2/src/main/webapp/app/templates/app/index.hbs
+++ b/tez-ui2/src/main/webapp/app/templates/app/index.hbs
@@ -35,11 +35,11 @@
</tr>
<tr>
<td>Start Time</td>
- <td>{{date-formatter content=model.startTime}}</td>
+ <td>{{date-formatter content=model.app.startTime}}</td>
</tr>
<tr>
<td>End Time</td>
- <td>{{date-formatter content=model.endTime}}</td>
+ <td>{{date-formatter content=model.app.endTime}}</td>
</tr>
<tr>
<td>Duration</td>
@@ -87,8 +87,8 @@
</thead>
<tbody>
<tr>
- <td>Application ID</td>
- <td>{{model.appID}}</td>
+ <td>Entity ID</td>
+ <td>{{model.entityID}}</td>
</tr>
<tr>
<td>Domain</td>
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js b/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js
index 9e2550d..3e1da55 100644
--- a/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js
+++ b/tez-ui2/src/main/webapp/tests/unit/entities/entity-test.js
@@ -167,3 +167,97 @@ test('loadAllNeeds silent=true test', function(assert) {
});
});
+test('_loadNeed single string type test', function(assert) {
+ let adapter = this.subject(),
+ loader,
+ testModel = Ember.Object.create({
+ refreshLoadTime: Ember.K,
+ needs: {
+ app: {
+ type: "appRm",
+ idKey: "appID",
+ silent: true
+ },
+ },
+ appID: 1,
+ });
+
+ assert.expect(2 + 1);
+
+ loader = {
+ queryRecord: function (type, id) {
+ assert.equal(id, testModel.get("appID"));
+ assert.equal(type, "appRm");
+ return Ember.RSVP.resolve();
+ }
+ };
+ adapter.loadAllNeeds(loader, testModel).then(function (val) {
+ assert.ok(val);
+ });
+});
+
+test('_loadNeed multiple type test', function(assert) {
+ let adapter = this.subject(),
+ loader,
+ testModel = Ember.Object.create({
+ refreshLoadTime: Ember.K,
+ needs: {
+ app: {
+ type: ["AhsApp", "appRm"],
+ idKey: "appID",
+ silent: true
+ },
+ },
+ appID: 1,
+ });
+
+ assert.expect(2 * 2 + 1);
+
+ loader = {
+ queryRecord: function (type, id) {
+ assert.equal(id, testModel.get("appID"));
+
+ if(type === "AhsApp") {
+ assert.ok(true);
+ return Ember.RSVP.reject();
+ }
+ else {
+ assert.equal(type, "appRm");
+ return Ember.RSVP.resolve();
+ }
+ }
+ };
+ adapter.loadAllNeeds(loader, testModel).then(function (val) {
+ assert.ok(val);
+ });
+});
+
+test('_loadNeed test with silent false', function(assert) {
+ let adapter = this.subject(),
+ loader,
+ testModel = Ember.Object.create({
+ refreshLoadTime: Ember.K,
+ needs: {
+ app: {
+ type: ["AhsApp"],
+ idKey: "appID",
+ silent: false
+ },
+ },
+ appID: 1,
+ }),
+ testErr = {};
+
+ assert.expect(2 + 1);
+
+ loader = {
+ queryRecord: function (type, id) {
+ assert.equal(id, testModel.get("appID"));
+ assert.equal(type, "AhsApp");
+ return Ember.RSVP.reject(testErr);
+ }
+ };
+ adapter.loadAllNeeds(loader, testModel).catch(function (err) {
+ assert.equal(err, testErr);
+ });
+});
http://git-wip-us.apache.org/repos/asf/tez/blob/d8390445/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js
index a5383ab..c736491 100644
--- a/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js
+++ b/tez-ui2/src/main/webapp/tests/unit/routes/am-pollster-test.js
@@ -29,6 +29,7 @@ test('Basic creation test', function(assert) {
assert.ok(route);
assert.ok(route.onRecordPoll);
assert.ok(route.onPollFailure);
+ assert.ok(route.scheduleReload);
assert.ok(route.reload);
assert.ok(route.actions.countersToPollChanged);
});