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 2017/01/09 13:28:58 UTC
tez git commit: TEZ-3504. Tez UI: Duration is displaying invalid
values when start or end time is invalid (sree)
Repository: tez
Updated Branches:
refs/heads/master e1f528864 -> ea061bcb4
TEZ-3504. Tez UI: Duration is displaying invalid values when start or end time is invalid (sree)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/ea061bcb
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/ea061bcb
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/ea061bcb
Branch: refs/heads/master
Commit: ea061bcb42eed1735def2e0dd530eda2d977faf3
Parents: e1f5288
Author: Sreenath Somarajapuram <sr...@apache.org>
Authored: Mon Jan 9 18:58:08 2017 +0530
Committer: Sreenath Somarajapuram <sr...@apache.org>
Committed: Mon Jan 9 18:58:08 2017 +0530
----------------------------------------------------------------------
CHANGES.txt | 1 +
tez-ui/src/main/webapp/app/models/ahs-app.js | 13 +--
tez-ui/src/main/webapp/app/models/timed.js | 49 +++++++++++
tez-ui/src/main/webapp/app/models/timeline.js | 11 +--
tez-ui/src/main/webapp/package.json | 2 +-
.../webapp/tests/unit/models/ahs-app-test.js | 15 +++-
.../main/webapp/tests/unit/models/timed-test.js | 86 ++++++++++++++++++++
.../webapp/tests/unit/models/timeline-test.js | 14 ----
8 files changed, 153 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/ea061bcb/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 09bdefb..e281c92 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -156,6 +156,7 @@ ALL CHANGES:
TEZ-3546. Tez UI: On sorting asc - Not Available must be at the top
TEZ-3555. Tez UI: Build is failing in RHEL6
TEZ-3570. Tez UI: Wait for sometime before tooltips are displayed
+ TEZ-3504. Tez UI: Duration is displaying invalid values when start or end time is invalid
Release 0.8.5: Unreleased
http://git-wip-us.apache.org/repos/asf/tez/blob/ea061bcb/tez-ui/src/main/webapp/app/models/ahs-app.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/models/ahs-app.js b/tez-ui/src/main/webapp/app/models/ahs-app.js
index c18bed9..eb2571f 100644
--- a/tez-ui/src/main/webapp/app/models/ahs-app.js
+++ b/tez-ui/src/main/webapp/app/models/ahs-app.js
@@ -16,12 +16,10 @@
* limitations under the License.
*/
-import Ember from 'ember';
-
import DS from 'ember-data';
-import AbstractModel from './abstract';
+import TimedModel from './timed';
-export default AbstractModel.extend({
+export default TimedModel.extend({
attemptID: DS.attr('string'),
name: DS.attr('string'),
@@ -32,12 +30,5 @@ export default AbstractModel.extend({
status: DS.attr('string'),
finalStatus: DS.attr('string'),
- startTime: DS.attr('number'),
- endTime: DS.attr('number'),
- duration: Ember.computed("startTime", "endTime", function () {
- var duration = this.get("endTime") - this.get("startTime");
- return duration > 0 ? duration : null;
- }),
-
diagnostics: DS.attr('string'),
});
http://git-wip-us.apache.org/repos/asf/tez/blob/ea061bcb/tez-ui/src/main/webapp/app/models/timed.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/models/timed.js b/tez-ui/src/main/webapp/app/models/timed.js
new file mode 100644
index 0000000..8892814
--- /dev/null
+++ b/tez-ui/src/main/webapp/app/models/timed.js
@@ -0,0 +1,49 @@
+/**
+ * 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 AbstractModel from './abstract';
+
+export default AbstractModel.extend({
+
+ startTime: DS.attr('number'),
+ endTime: DS.attr('number'),
+
+ duration: Ember.computed("startTime", "endTime", function () {
+ var startTime = this.get("startTime"),
+ endTime = this.get("endTime");
+
+ if(startTime !== undefined && endTime !== undefined && startTime !== null && endTime !== null) {
+ if(startTime <= 0) {
+ return new Error("Start time is less than or equal to zero!");
+ }
+ else if(endTime <= 0) {
+ return new Error("End time is less than or equal to zero!");
+ }
+ else if(startTime > endTime) {
+ let delta = startTime - endTime;
+ return new Error(`Start time is greater than end time by ${delta} msecs!`);
+ }
+
+ return endTime - startTime;
+ }
+ }),
+
+});
http://git-wip-us.apache.org/repos/asf/tez/blob/ea061bcb/tez-ui/src/main/webapp/app/models/timeline.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/models/timeline.js b/tez-ui/src/main/webapp/app/models/timeline.js
index a0b83e2..0b1231c 100644
--- a/tez-ui/src/main/webapp/app/models/timeline.js
+++ b/tez-ui/src/main/webapp/app/models/timeline.js
@@ -19,9 +19,9 @@
import DS from 'ember-data';
import Ember from 'ember';
-import AbstractModel from './abstract';
+import TimedModel from './timed';
-export default AbstractModel.extend({
+export default TimedModel.extend({
needs:{
app: {
@@ -57,13 +57,6 @@ export default AbstractModel.extend({
return this.get("status") === "SUCCEEDED" ? 1 : null;
}),
- startTime: DS.attr("number"),
- endTime: DS.attr("number"),
- duration: Ember.computed("startTime", "endTime", function () {
- var duration = this.get("endTime") - this.get("startTime");
- return duration > 0 ? duration : null;
- }),
-
// Hash will be created only on demand, till then counters will be stored in _counterGroups
_counterGroups: DS.attr('object'),
counterGroupsHash: Ember.computed("_counterGroups", function () {
http://git-wip-us.apache.org/repos/asf/tez/blob/ea061bcb/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 83d964b..433a9bc 100644
--- a/tez-ui/src/main/webapp/package.json
+++ b/tez-ui/src/main/webapp/package.json
@@ -57,7 +57,7 @@
"phantomjs-prebuilt": "2.1.13"
},
"dependencies": {
- "em-helpers": "0.5.14",
+ "em-helpers": "0.6.0",
"em-table": "0.4.0",
"em-tgraph": "0.0.9"
}
http://git-wip-us.apache.org/repos/asf/tez/blob/ea061bcb/tez-ui/src/main/webapp/tests/unit/models/ahs-app-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/models/ahs-app-test.js b/tez-ui/src/main/webapp/tests/unit/models/ahs-app-test.js
index 5fd9c60..a80c325 100644
--- a/tez-ui/src/main/webapp/tests/unit/models/ahs-app-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/models/ahs-app-test.js
@@ -26,6 +26,15 @@ moduleForModel('ahs-app', 'Unit | Model | ahs app', {
test('Basic creation test', function(assert) {
let model = this.subject();
- assert.ok(!!model);
- assert.ok(!!model.duration);
-});
+ assert.ok(model);
+
+ assert.ok(model.name);
+ assert.ok(model.queue);
+ assert.ok(model.user);
+ assert.ok(model.type);
+
+ assert.ok(model.status);
+ assert.ok(model.finalStatus);
+
+ assert.ok(model.diagnostics);
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tez/blob/ea061bcb/tez-ui/src/main/webapp/tests/unit/models/timed-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/models/timed-test.js b/tez-ui/src/main/webapp/tests/unit/models/timed-test.js
new file mode 100644
index 0000000..77b4308
--- /dev/null
+++ b/tez-ui/src/main/webapp/tests/unit/models/timed-test.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.
+ */
+
+import Ember from 'ember';
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('timed', 'Unit | Model | timed', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('it exists', function(assert) {
+ let model = this.subject();
+
+ assert.ok(model);
+ assert.ok(model.startTime);
+ assert.ok(model.duration);
+ assert.ok(model.endTime);
+});
+
+test('duration test', function(assert) {
+ let model = this.subject();
+
+ function resetAndCheckModel () {
+ model.set("startTime", 100);
+ model.set("endTime", 200);
+
+ assert.equal(model.get("duration"), 100);
+ }
+
+ Ember.run(function () {
+ resetAndCheckModel();
+ model.set("endTime", 100);
+ assert.equal(model.get("duration"), 0);
+
+ model.set("startTime", 0);
+ assert.equal(model.get("duration").message, "Start time is less than or equal to zero!");
+
+ resetAndCheckModel();
+ model.set("endTime", 0);
+ assert.equal(model.get("duration").message, "End time is less than or equal to zero!");
+
+ resetAndCheckModel();
+ model.set("endTime", 50);
+ assert.equal(model.get("duration").message, "Start time is greater than end time by 50 msecs!");
+
+ resetAndCheckModel();
+ model.set("startTime", -100);
+ assert.equal(model.get("duration").message, "Start time is less than or equal to zero!");
+
+ resetAndCheckModel();
+ model.set("endTime", -200);
+ assert.equal(model.get("duration").message, "End time is less than or equal to zero!");
+
+ resetAndCheckModel();
+ model.set("startTime", undefined);
+ assert.equal(model.get("duration"), undefined);
+
+ resetAndCheckModel();
+ model.set("endTime", undefined);
+ assert.equal(model.get("duration"), undefined);
+
+ resetAndCheckModel();
+ model.set("startTime", null);
+ assert.equal(model.get("duration"), undefined);
+
+ resetAndCheckModel();
+ model.set("endTime", null);
+ assert.equal(model.get("duration"), undefined);
+ });
+});
http://git-wip-us.apache.org/repos/asf/tez/blob/ea061bcb/tez-ui/src/main/webapp/tests/unit/models/timeline-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/models/timeline-test.js b/tez-ui/src/main/webapp/tests/unit/models/timeline-test.js
index c47054e..04f249e 100644
--- a/tez-ui/src/main/webapp/tests/unit/models/timeline-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/models/timeline-test.js
@@ -39,10 +39,6 @@ test('Basic creation test', function(assert) {
assert.ok(model.status);
assert.ok(model.progress);
- assert.ok(model.startTime);
- assert.ok(model.endTime);
- assert.ok(model.duration);
-
assert.ok(model._counterGroups);
assert.ok(model.counterGroupsHash);
});
@@ -82,16 +78,6 @@ test('progress test', function(assert) {
});
});
-test('duration test', function(assert) {
- let model = this.subject();
-
- Ember.run(function () {
- model.set("startTime", 100);
- model.set("endTime", 200);
- assert.equal(model.get("duration"), 100);
- });
-});
-
test('counterGroupsHash test', function(assert) {
let model = this.subject(),
testCounterGroup = [{