You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by zh...@apache.org on 2017/03/28 19:47:55 UTC

[14/50] [abbrv] tez git commit: TEZ-3629. Tez UI: Enable the UI to display log links from LLAP (sree)

TEZ-3629. Tez UI: Enable the UI to display log links from LLAP (sree)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/39143424
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/39143424
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/39143424

Branch: refs/heads/TEZ-1190
Commit: 391434246f6e3fba8db03cae8c8084895b16c504
Parents: 8c311e4
Author: Sreenath Somarajapuram <sr...@apache.org>
Authored: Wed Feb 22 16:32:53 2017 +0530
Committer: Sreenath Somarajapuram <sr...@apache.org>
Committed: Wed Feb 22 16:32:53 2017 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 tez-ui/src/main/webapp/app/initializers/env.js  |  1 +
 tez-ui/src/main/webapp/app/models/abstract.js   |  1 +
 tez-ui/src/main/webapp/app/models/attempt.js    | 17 ++++++++++-
 .../src/main/webapp/app/serializers/attempt.js  | 15 ++--------
 .../webapp/tests/unit/models/abstract-test.js   | 27 +++++++++++++++++
 .../webapp/tests/unit/models/attempt-test.js    | 31 ++++++++++++++++++++
 .../tests/unit/serializers/attempt-test.js      |  9 +++---
 8 files changed, 84 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/39143424/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a5c59ca..54cddc8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -200,6 +200,7 @@ ALL CHANGES:
   TEZ-3602. Tez UI: Query Name field is not required
   TEZ-3615. Tez UI: Table changes
   TEZ-3619. Tez UI: Improve DAG Data download
+  TEZ-3629. Tez UI: Enable the UI to display log links from LLAP
 
 Release 0.8.5: Unreleased
 

http://git-wip-us.apache.org/repos/asf/tez/blob/39143424/tez-ui/src/main/webapp/app/initializers/env.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/initializers/env.js b/tez-ui/src/main/webapp/app/initializers/env.js
index 591d989..9edc74c 100644
--- a/tez-ui/src/main/webapp/app/initializers/env.js
+++ b/tez-ui/src/main/webapp/app/initializers/env.js
@@ -21,6 +21,7 @@ export function initialize(application) {
   application.inject('route', 'env', 'service:env');
   application.inject('adapter', 'env', 'service:env');
   application.inject('serializer', 'env', 'service:env');
+  application.inject('model', 'env', 'service:env');
 }
 
 export default {

http://git-wip-us.apache.org/repos/asf/tez/blob/39143424/tez-ui/src/main/webapp/app/models/abstract.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/models/abstract.js b/tez-ui/src/main/webapp/app/models/abstract.js
index 24bcbd3..1109914 100644
--- a/tez-ui/src/main/webapp/app/models/abstract.js
+++ b/tez-ui/src/main/webapp/app/models/abstract.js
@@ -52,6 +52,7 @@ export default DS.Model.extend({
       case "FINISHED":
       case "FAILED":
       case "KILLED":
+      case "ERROR":
         return true;
     }
     return false;

http://git-wip-us.apache.org/repos/asf/tez/blob/39143424/tez-ui/src/main/webapp/app/models/attempt.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/models/attempt.js b/tez-ui/src/main/webapp/app/models/attempt.js
index ab54b22..6e0b05e 100644
--- a/tez-ui/src/main/webapp/app/models/attempt.js
+++ b/tez-ui/src/main/webapp/app/models/attempt.js
@@ -72,7 +72,22 @@ export default AMTimelineModel.extend({
   containerID: DS.attr('string'),
   nodeID: DS.attr('string'),
 
-  logURL: DS.attr('string'),
+  inProgressLogsURL: DS.attr('string'),
+  completedLogsURL: DS.attr('string'),
+  logURL: Ember.computed("entityID", "inProgressLogsURL", "completedLogsURL", "dag.isComplete", function () {
+    var logURL = this.get("inProgressLogsURL");
+
+    if(logURL) {
+      if(logURL.indexOf("://") === -1) {
+        let attemptID = this.get("entityID"),
+            yarnProtocol = this.get('env.app.yarnProtocol');
+        return `${yarnProtocol}://${logURL}/syslog_${attemptID}`;
+      }
+      else { // LLAP log link
+        return this.get("dag.isComplete") ? this.get("completedLogsURL") : logURL;
+      }
+    }
+  }),
 
   containerLogURL: DS.attr('string'),
 });

http://git-wip-us.apache.org/repos/asf/tez/blob/39143424/tez-ui/src/main/webapp/app/serializers/attempt.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/serializers/attempt.js b/tez-ui/src/main/webapp/app/serializers/attempt.js
index 60f7a89..dd54135 100644
--- a/tez-ui/src/main/webapp/app/serializers/attempt.js
+++ b/tez-ui/src/main/webapp/app/serializers/attempt.js
@@ -20,21 +20,11 @@ import Ember from 'ember';
 
 import TimelineSerializer from './timeline';
 
-function createLogURL(source) {
-  var logURL = Ember.get(source, 'otherinfo.inProgressLogsURL'),
-      attemptID = Ember.get(source, 'entity'),
-      yarnProtocol = this.get('env.app.yarnProtocol');
-
-  if(logURL) {
-    return `${yarnProtocol}://${logURL}/syslog_${attemptID}`;
-  }
-}
-
 function createContainerLogURL(source) {
   var logURL = Ember.get(source, 'otherinfo.inProgressLogsURL'),
       yarnProtocol = this.get('env.app.yarnProtocol');
 
-  if(logURL) {
+  if(logURL && logURL.indexOf("://") === -1) {
     return `${yarnProtocol}://${logURL}`;
   }
 }
@@ -48,7 +38,8 @@ export default TimelineSerializer.extend({
     containerID: 'otherinfo.containerId',
     nodeID: 'otherinfo.nodeId',
 
-    logURL: createLogURL,
+    inProgressLogsURL: "otherinfo.inProgressLogsURL",
+    completedLogsURL: "otherinfo.completedLogsURL",
 
     containerLogURL: createContainerLogURL
   }

http://git-wip-us.apache.org/repos/asf/tez/blob/39143424/tez-ui/src/main/webapp/tests/unit/models/abstract-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/models/abstract-test.js b/tez-ui/src/main/webapp/tests/unit/models/abstract-test.js
index bd6f141..5a012f5 100644
--- a/tez-ui/src/main/webapp/tests/unit/models/abstract-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/models/abstract-test.js
@@ -41,6 +41,33 @@ test('Basic test for existence', function(assert) {
   assert.ok(model.isComplete);
 });
 
+test('isComplete test', function(assert) {
+  let model = this.subject();
+  assert.equal(model.get("isComplete"), false);
+
+  Ember.run(function () {
+    model.set("status", "SUCCEEDED");
+    assert.equal(model.get("isComplete"), true);
+
+    model.set("status", null);
+    assert.equal(model.get("isComplete"), false);
+    model.set("status", "FINISHED");
+    assert.equal(model.get("isComplete"), true);
+
+    model.set("status", null);
+    model.set("status", "FAILED");
+    assert.equal(model.get("isComplete"), true);
+
+    model.set("status", null);
+    model.set("status", "KILLED");
+    assert.equal(model.get("isComplete"), true);
+
+    model.set("status", null);
+    model.set("status", "ERROR");
+    assert.equal(model.get("isComplete"), true);
+  });
+});
+
 test('_notifyProperties test - will fail if _notifyProperties implementation is changed in ember-data', function(assert) {
   let model = this.subject();
 

http://git-wip-us.apache.org/repos/asf/tez/blob/39143424/tez-ui/src/main/webapp/tests/unit/models/attempt-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/models/attempt-test.js b/tez-ui/src/main/webapp/tests/unit/models/attempt-test.js
index faa27ad..a15e3c9 100644
--- a/tez-ui/src/main/webapp/tests/unit/models/attempt-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/models/attempt-test.js
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import Ember from 'ember';
 import { moduleForModel, test } from 'ember-qunit';
 
 moduleForModel('attempt', 'Unit | Model | attempt', {
@@ -44,7 +45,10 @@ test('Basic creation test', function(assert) {
   assert.ok(model.containerID);
   assert.ok(model.nodeID);
 
+  assert.ok(model.inProgressLogsURL);
+  assert.ok(model.completedLogsURL);
   assert.ok(model.logURL);
+  assert.ok(model.containerLogURL);
 });
 
 test('index test', function(assert) {
@@ -76,3 +80,30 @@ test('vertexName test', function(assert) {
 
   assert.equal(model.get("vertexName"), testVertexName);
 });
+
+test('logURL test', function(assert) {
+  let model = this.subject({
+        entityID: "id_1",
+        dag: Ember.Object.create(),
+        env: {
+          app: {
+            yarnProtocol: "ptcl"
+          }
+        },
+        completedLogsURL: "http://abc.com/completed/link.log.done"
+      });
+
+  Ember.run(function () {
+    // Normal Tez log link
+    model.set("inProgressLogsURL", "abc.com/test/link");
+    assert.equal(model.get("logURL"), "ptcl://abc.com/test/link/syslog_id_1");
+
+    // LLAP log link - In Progress
+    model.set("inProgressLogsURL", "http://abc.com/in-progress/link.log");
+    assert.equal(model.get("logURL"), "http://abc.com/in-progress/link.log");
+
+    // LLAP log link - Completed
+    model.set("dag.isComplete", true);
+    assert.equal(model.get("logURL"), "http://abc.com/completed/link.log.done");
+  });
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tez/blob/39143424/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js b/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js
index aaeab62..4715acd 100644
--- a/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/serializers/attempt-test.js
@@ -27,10 +27,10 @@ test('Basic creation test', function(assert) {
   let serializer = this.subject();
 
   assert.ok(serializer);
-  assert.ok(serializer.maps.logURL);
+  assert.equal(Object.keys(serializer.maps).length, 8 + 8);
 });
 
-test('logURL test', function(assert) {
+test('containerLogURL test', function(assert) {
   let serializer = this.subject({
     env: {
       app: {
@@ -39,10 +39,9 @@ test('logURL test', function(assert) {
     }
   });
 
-  assert.equal(serializer.maps.logURL.call(serializer, {
-    entity: "id_1",
+  assert.equal(serializer.maps.containerLogURL.call(serializer, {
     otherinfo: {
       inProgressLogsURL: "abc.com/test/link",
     }
-  }), "ptcl://abc.com/test/link/syslog_id_1");
+  }), "ptcl://abc.com/test/link");
 });