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/05/17 12:03:03 UTC

tez git commit: TEZ-3255. Tez UI: Hide swimlane while displaying running DAGs from old versions of Tez (sree)

Repository: tez
Updated Branches:
  refs/heads/master c5ad13ed5 -> af0a3f775


TEZ-3255. Tez UI: Hide swimlane while displaying running DAGs from old versions of Tez (sree)


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

Branch: refs/heads/master
Commit: af0a3f775439dea1306caae3640019a6ae7b2733
Parents: c5ad13e
Author: Sreenath Somarajapuram <sr...@apache.org>
Authored: Tue May 17 17:33:01 2016 +0530
Committer: Sreenath Somarajapuram <sr...@apache.org>
Committed: Tue May 17 17:33:01 2016 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../main/webapp/app/controllers/dag/swimlane.js | 22 ++++++++++
 .../main/webapp/app/templates/dag/swimlane.hbs  | 41 ++++++++++---------
 .../tests/unit/controllers/dag/swimlane-test.js | 42 ++++++++++++++++++++
 4 files changed, 88 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/af0a3f77/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 04cada7..7b34f19 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -30,6 +30,7 @@ ALL CHANGES:
   TEZ-3233. Tez UI: Have LLAP information reflect in Tez UI
   TEZ-3086. Tez UI: Backward compatibility changes
   TEZ-3254. Tez UI: Consider downloading Hive/Pig explain plans
+  TEZ-3255. Tez UI: Hide swimlane while displaying running DAGs from old versions of Tez
 
 Release 0.8.4: Unreleased
 

http://git-wip-us.apache.org/repos/asf/tez/blob/af0a3f77/tez-ui/src/main/webapp/app/controllers/dag/swimlane.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/controllers/dag/swimlane.js b/tez-ui/src/main/webapp/app/controllers/dag/swimlane.js
index 259d72f..68f1410 100644
--- a/tez-ui/src/main/webapp/app/controllers/dag/swimlane.js
+++ b/tez-ui/src/main/webapp/app/controllers/dag/swimlane.js
@@ -101,6 +101,28 @@ export default MultiTableController.extend({
     contentPath: 'processorClassName',
   }]),
 
+  dataAvailable: Ember.computed("model.firstObject.dag.amWsVersion",
+      "model.firstObject.dag.isComplete",
+      "model.firstObject.am.initTime", function () {
+    var vertex = this.get("model.firstObject"),
+        dag = this.get("model.firstObject.dag"),
+        dataAvailable = true;
+
+    if(vertex && dag && !dag.get("isComplete")) {
+      let amWsVersion = dag.get("amWsVersion");
+      // amWsVersion = undefined or 1
+      if(!amWsVersion || amWsVersion === 1) {
+        dataAvailable = false;
+      }
+      // amWsVersion >= 2, but without event/time data
+      if(vertex.get("am") && !vertex.get("am.initTime")) {
+        dataAvailable = false;
+      }
+    }
+
+    return dataAvailable;
+  }),
+
   processes: Ember.computed("model", function () {
     var processes = [],
         processHash = {},

http://git-wip-us.apache.org/repos/asf/tez/blob/af0a3f77/tez-ui/src/main/webapp/app/templates/dag/swimlane.hbs
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/templates/dag/swimlane.hbs b/tez-ui/src/main/webapp/app/templates/dag/swimlane.hbs
index 7c50e81..dbbe23fc 100644
--- a/tez-ui/src/main/webapp/app/templates/dag/swimlane.hbs
+++ b/tez-ui/src/main/webapp/app/templates/dag/swimlane.hbs
@@ -17,26 +17,31 @@
 }}
 
 {{#if loaded}}
-  <div class="swimlane-page">
-    <div class="button-panel">
-      <div class="zoom-range">
-        {{zoom}}%
-        {{input type="range" value=zoom min=100 max=1000}}
+  {{#if dataAvailable}}
+    <div class="swimlane-page">
+      <div class="button-panel">
+        <div class="zoom-range">
+          {{zoom}}%
+          {{input type="range" value=zoom min=100 max=1000}}
+        </div>
+        <i class='fa fa-cog fa-border' {{action 'openColumnSelector'}} title="Customize vertex tooltip"></i>
+        <i class='fa fa-expand fa-border' {{action 'toggleFullscreen'}} title="Toggle fullscreen"></i>
+        <i class='fa fa-compress fa-border' {{action 'toggleFullscreen'}} title="Toggle fullscreen"></i>
       </div>
-      <i class='fa fa-cog fa-border' {{action 'openColumnSelector'}} title="Customize vertex tooltip"></i>
-      <i class='fa fa-expand fa-border' {{action 'toggleFullscreen'}} title="Toggle fullscreen"></i>
-      <i class='fa fa-compress fa-border' {{action 'toggleFullscreen'}} title="Toggle fullscreen"></i>
-    </div>
 
-    {{em-swimlane
-      columns=visibleColumns
-      processes=processes
-      nameComponent="em-swimlane-vertex-name"
-      zoom=zoom
-      click="click"
-      consolidate=true
-    }}
-  </div>
+      {{em-swimlane
+        columns=visibleColumns
+        processes=processes
+        nameComponent="em-swimlane-vertex-name"
+        zoom=zoom
+        click="click"
+        consolidate=true
+      }}
+    </div>
+  {{else}}
+    <h2>Data not available to display swimlane for a running DAG!</h2>
+    <h4>You might be using an older version of Tez. Please get back after DAG completion.</h4>
+  {{/if}}
 {{else}}
   {{partial "loading"}}
 {{/if}}

http://git-wip-us.apache.org/repos/asf/tez/blob/af0a3f77/tez-ui/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js b/tez-ui/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js
index 7509dee..48c96a2 100644
--- a/tez-ui/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/controllers/dag/swimlane-test.js
@@ -41,6 +41,8 @@ test('Basic creation test', function(assert) {
   assert.ok(controller.columns);
   assert.ok(controller.processes);
 
+  assert.ok(controller.dataAvailable);
+
   assert.ok(controller.actions.toggleFullscreen);
   assert.ok(controller.actions.click);
 });
@@ -87,3 +89,43 @@ test('Processes test', function(assert) {
   assert.equal(processes[2].blockers[1].vertex, vertices[1]);
   assert.equal(processes[3].blockers[0].vertex, vertices[2]);
 });
+
+test('dataAvailable test', function(assert) {
+  let controller = this.subject({
+    send: Ember.K,
+    beforeSort: {bind: Ember.K},
+    initVisibleColumns: Ember.K,
+    getCounterColumns: function () {
+      return [];
+    }
+  }),
+  dag = Ember.Object.create(),
+  vertex = Ember.Object.create({
+    dag: dag
+  });
+
+  assert.equal(controller.get("dataAvailable"), true, "No DAG or vertex");
+
+  controller.set("model", Ember.Object.create({
+    firstObject: vertex
+  }));
+  assert.equal(controller.get("dataAvailable"), false, "With vertex & dag but no amWsVersion");
+
+  dag.set("isComplete", true);
+  assert.equal(controller.get("dataAvailable"), true, "Complete DAG");
+  dag.set("isComplete", false);
+
+  dag.set("amWsVersion", 1);
+  assert.equal(controller.get("dataAvailable"), false, "With vertex & dag but amWsVersion=1");
+
+  dag.set("amWsVersion", 2);
+  assert.equal(controller.get("dataAvailable"), true, "With vertex & dag but amWsVersion=2");
+
+  vertex.set("am", {});
+  assert.equal(controller.get("dataAvailable"), false, "am loaded without event time data");
+
+  vertex.set("am", {
+    initTime: Date.now()
+  });
+  assert.equal(controller.get("dataAvailable"), true, "am loaded with event time data");
+});