tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject tez git commit: TEZ-2546. Tez UI: Fetch hive query text from timeline if dagInfo is not set. (sree)
Date Wed, 10 Jun 2015 14:40:03 GMT
Repository: tez
Updated Branches:
  refs/heads/branch-0.7 1e03be2cf -> 6bdb57184


TEZ-2546. Tez UI: Fetch hive query text from timeline if dagInfo is not set. (sree)

(cherry picked from commit 994c7491414737aaede01d21ec86c34d0b3143ae)


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

Branch: refs/heads/branch-0.7
Commit: 6bdb5718445be70e168fc8e7988a05a74808e554
Parents: 1e03be2
Author: Sreenath Somarajapuram <sree@apache.org>
Authored: Wed Jun 10 20:07:06 2015 +0530
Committer: Sreenath Somarajapuram <sree@apache.org>
Committed: Wed Jun 10 20:08:47 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 tez-ui/src/main/webapp/app/scripts/app.js       | 17 +++++++
 tez-ui/src/main/webapp/app/scripts/configs.js   |  5 ++
 .../app/scripts/controllers/dag_controller.js   | 17 +++++++
 .../scripts/controllers/dag_index_controller.js | 48 ++++----------------
 .../src/main/webapp/app/scripts/helpers/misc.js |  4 ++
 .../app/scripts/models/TimelineRestAdapter.js   | 44 +++++++++++++++++-
 .../src/main/webapp/app/scripts/models/dag.js   | 26 ++++++-----
 tez-ui/src/main/webapp/app/styles/main.less     |  6 +++
 .../src/main/webapp/app/templates/dag/index.hbs |  8 ++--
 10 files changed, 122 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d8bc5fe..87503bd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@ Release 0.7.1: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES:
+  TEZ-2546. Tez UI: Fetch hive query text from timeline if dagInfo is not set.
   TEZ-2513. Tez UI: Allow filtering by DAG ID on All dags table.
   TEZ-2541. DAGClientImpl enable TimelineClient check is wrong.
   TEZ-2539. Tez UI: Pages are not updating in IE.

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/tez-ui/src/main/webapp/app/scripts/app.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/app.js b/tez-ui/src/main/webapp/app/scripts/app.js
index 7d8c515..4ca7b96 100644
--- a/tez-ui/src/main/webapp/app/scripts/app.js
+++ b/tez-ui/src/main/webapp/app/scripts/app.js
@@ -46,6 +46,23 @@ var App = window.App = Em.Application.createWithMixins(Bootstrap, {
     App.advanceReadiness();
   }
 });
+
+Em.Application.initializer({
+  name: "objectTransforms",
+
+  initialize: function(container, application) {
+    application.register('transform:object', DS.Transform.extend({
+      deserialize: function(serialized) {
+        return Em.none(serialized) ? {} : serialized;
+      },
+
+      serialized: function(deserialized) {
+        return Em.none(deserialized) ? {} : deserialized;
+      }
+    }));
+  }
+});
+
 App.deferReadiness();
 
 App.Helpers = Em.Namespace.create(),

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/tez-ui/src/main/webapp/app/scripts/configs.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/configs.js b/tez-ui/src/main/webapp/app/scripts/configs.js
index 1e2782f..7fef209 100644
--- a/tez-ui/src/main/webapp/app/scripts/configs.js
+++ b/tez-ui/src/main/webapp/app/scripts/configs.js
@@ -32,6 +32,11 @@ App.setConfigs({
      * the following value to point to a different domain.
      */
     // RMWebUrl: 'http://localhost:8088',
+
+    /*
+     * Ensures that some of the UI features work with old versions of Tez
+     */
+    compatibilityMode: false,
   },
 
   /*

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/tez-ui/src/main/webapp/app/scripts/controllers/dag_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag_controller.js
index ea85c47..cef1827 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dag_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag_controller.js
@@ -61,6 +61,23 @@ App.DagController = Em.ObjectController.extend(App.Helpers.DisplayHelper,
{
       that.set('loading', false);
     });
 
+    if (!dag.get('appContextInfo.info') && App.get('env.compatibilityMode')) {
+      var dagName = dag.getWithDefault('name', '');
+      var hiveQueryId = dagName.replace(/([^:]*):.*/, '$1');
+      if (dagName !=  hiveQueryId && !!hiveQueryId) {
+        this.store.find('hiveQuery', hiveQueryId).then(function (hiveQueryData) {
+          var queryInfoStr = Em.get(hiveQueryData || {}, 'query') || '{}';
+          var queryInfo = $.parseJSON(queryInfoStr);
+          dag.set('appContextInfo', {
+            appType: 'Hive',
+            info: queryInfo['queryText']
+          });
+        }).catch(function (e) {
+          // ignore.
+        });
+      }
+    }
+
     return Em.RSVP.all(loaders);
   },
 

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
index e120bd6..795c9e3 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
@@ -115,41 +115,17 @@ App.DagIndexController = Em.ObjectController.extend(App.ModelRefreshMixin,
{
     return '#/dag/%@/taskAttempts?searchText=Status%3AFAILED'.fmt(this.get('id'));
   }.property('id'),
 
-  dagPlanContextInfoJson: function() {
-    var dagInfo = {
-          context: null,
-          description: ''
-        },
-        dagInfoStr = this.get('dagPlanContextInfo');
-
-    try {
-      var tmpInfo = $.parseJSON(dagInfoStr);
-      dagInfo.context = tmpInfo['context'];
-      dagInfo.description = tmpInfo['description'];
-    } catch (err) {
-      Em.Logger.debug("error parsing daginfo " + err);
-      dagInfo.description = dagInfoStr;     
-    }
-
-    return dagInfo;
-  }.property('dagPlanContextInfo'),
+  appContext: function() {
+    return this.get('appContextInfo.info')
+  }.property('appContextInfo.info'),
 
-  hasDagInfoContext: function() {
-    var x = this.get('dagPlanContextInfoJson');
-    return !!this.get('dagPlanContextInfoJson').description;
-  }.property('dagPlanContextInfoJson'),
+  appContextHeading: function() {
+    var appContextType = this.get('appContextInfo.appType');
+    return 'Additional Info' + (!!appContextType ? ' from ' + appContextType : '');
+  }.property('appContextInfo.appType'),
 
-  additionalInfoHeading: function() {
-    var contextName = this.get('dagPlanContextInfoJson').context;
-    var heading = "Additional Info"
-    if (!!contextName) {
-      heading += " from " + contextName;
-    }
-    return heading;
-  }.property('dagPlanContextInfoJson'),
-
-  dagInfoContextType: function() {
-    switch (this.get('dagPlanContextInfoJson').context) {
+  appInfoContextType: function() {
+    switch (this.get('appContextInfo.appType')) {
       case 'Hive':
         return 'text/x-hive';
       case 'Pig':
@@ -157,10 +133,6 @@ App.DagIndexController = Em.ObjectController.extend(App.ModelRefreshMixin,
{
       default:
         return 'text/x-sql';
     }
-  }.property('dagPlanContextInfoJson'),
-
-  dagInfoContextDesc: function() {
-    return this.get('dagPlanContextInfoJson').description || 'N/A'
-  }.property('dagPlanContextInfoJson'),
+  }.property('appContextInfo.appType'),
 
 });

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
index 27ff4a5..8360af0 100644
--- a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
+++ b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
@@ -548,6 +548,8 @@ App.Helpers.misc = {
       vertexTaskAttempt: 'TEZ_TASK_ATTEMPT_ID',
       taskTaskAttempt: 'TEZ_TASK_ATTEMPT_ID',
 
+      hiveQuery: 'HIVE_QUERY_ID',
+
       tezApp: 'TEZ_APPLICATION'
     };
     return function (type) {
@@ -571,6 +573,8 @@ App.Helpers.misc = {
       vertexTaskAttempt: 'TEZ_TASK_ATTEMPT_ID',
       taskTaskAttempt: 'TEZ_TASK_ATTEMPT_ID',
 
+      hiveQuery: 'HIVE_QUERY_ID',
+
       tezApp: 'applicationId'
     };
     return function (type) {

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js b/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js
index a8da1dd..9e6f013 100644
--- a/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js
+++ b/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js
@@ -109,7 +109,27 @@ var timelineJsonToDagMap = {
 
   planName: 'otherinfo.dagPlan.dagName',
   planVersion: 'otherinfo.dagPlan.version',
-  dagPlanContextInfo: 'otherinfo.dagPlan.dagInfo',
+  appContextInfo: {
+    custom: function (source) {
+      var appType = undefined,
+          info = undefined;
+      var dagInfoStr = Em.get(source, 'otherinfo.dagPlan.dagInfo');
+      if (!!dagInfoStr) {
+        try {
+          var dagInfo = $.parseJSON(dagInfoStr);
+          appType = dagInfo['context'];
+          info = dagInfo['description'];
+        } catch (e) {
+          info = dagInfoStr;
+        }
+      }
+
+      return {
+        appType: appType,
+        info: info
+      };
+    }
+  },
   vertices: 'otherinfo.dagPlan.vertices',
   edges: 'otherinfo.dagPlan.edges',
   vertexGroups: 'otherinfo.dagPlan.vertexGroups',
@@ -476,5 +496,27 @@ App.TezAppSerializer = App.TimelineSerializer.extend({
   },
 });
 
+var timelineJsonToHiveQueryMap = {
+  id: 'entity',
+  query: 'otherinfo.QUERY'
+};
+
+App.HiveQuerySerializer = App.TimelineSerializer.extend({
+  _normalizeSingleDagPayload: function(hiveQuery) {
+    return {
+      hiveQuery: hiveQuery
+    }
+  },
+
+  normalizePayload: function(rawPayload){
+    // we handled only single hive
+    return this._normalizeSingleDagPayload(rawPayload.hiveQuery);
+  },
+
+  normalize: function(type, hash, prop) {
+    return Em.JsonMapper.map(hash, timelineJsonToHiveQueryMap);
+  }
+});
+
 App.VertexProgressSerializer = App.DagProgressSerializer = DS.RESTSerializer.extend({});
 

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/tez-ui/src/main/webapp/app/scripts/models/dag.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/models/dag.js b/tez-ui/src/main/webapp/app/scripts/models/dag.js
index f4070c3..08dfb48 100644
--- a/tez-ui/src/main/webapp/app/scripts/models/dag.js
+++ b/tez-ui/src/main/webapp/app/scripts/models/dag.js
@@ -33,14 +33,14 @@ App.Dag = App.AbstractEntity.extend({
     return App.Helpers.date.duration(this.get('startTime'), this.get('endTime'))
   }.property('startTime', 'endTime'),
 
-	// set type to DAG
-	entityType: App.EntityType.DAG,
+  // set type to DAG
+  entityType: App.EntityType.DAG,
 
-	// Name of the dag.
-	name: DS.attr('string'),
+  // Name of the dag.
+  name: DS.attr('string'),
 
-	// user name who ran this dag.
-	user: DS.attr('string'),
+  // user name who ran this dag.
+  user: DS.attr('string'),
 
   // application ID of this dag.
   applicationId: function() {
@@ -50,8 +50,8 @@ App.Dag = App.AbstractEntity.extend({
   tezApp: DS.belongsTo('tezApp'),
   appDetail: DS.belongsTo('appDetail'),
 
-	// status
-	status: DS.attr('string'),
+  // status
+  status: DS.attr('string'),
   hasFailedTaskAttempts: DS.attr('boolean'),
   hasFailedTasks: function() {
     var f = this.get('numFailedTasks');
@@ -59,13 +59,13 @@ App.Dag = App.AbstractEntity.extend({
   }.property('numFailedTasks'),
   numFailedTasks: DS.attr('number'),
 
-	// diagnostics info if any.
-	diagnostics: DS.attr('string'),
+  // diagnostics info if any.
+  diagnostics: DS.attr('string'),
 
   // Dag plan reated data
   planName: DS.attr('string'),
   planVersion: DS.attr('number'),
-  dagPlanContextInfo: DS.attr('string'),
+  appContextInfo: DS.attr('object'),
   vertices: DS.attr('array'), // Serialize when required
   edges: DS.attr('array'), // Serialize when required
   vertexGroups: DS.attr('array'),
@@ -391,6 +391,10 @@ App.KVDatum = DS.Model.extend({
   value: DS.attr('string'),
 });
 
+App.HiveQuery = DS.Model.extend({
+  query: DS.attr('string')
+});
+
 App.VertexState = {
   NEW: "NEW",
   INITIALIZING: "INITIALIZING",

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/tez-ui/src/main/webapp/app/styles/main.less
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/styles/main.less b/tez-ui/src/main/webapp/app/styles/main.less
index 7c6e14c..6390ffc 100644
--- a/tez-ui/src/main/webapp/app/styles/main.less
+++ b/tez-ui/src/main/webapp/app/styles/main.less
@@ -922,3 +922,9 @@ body, html {
   height: auto !important;
   viewportMargin: Infinity !important;
 }
+
+.code-mirror-container {
+  .panel-body {
+    padding: 0px;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tez/blob/6bdb5718/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 ec80f6c..504da2f 100644
--- a/tez-ui/src/main/webapp/app/templates/dag/index.hbs
+++ b/tez-ui/src/main/webapp/app/templates/dag/index.hbs
@@ -93,10 +93,10 @@
   </div>
 {{/if}}
 
-{{#if hasDagInfoContext}}
-  <div class='margin-small-vertical'>
-    {{#bs-panel heading=additionalInfoHeading collapsible=false dismiss=false type='info'}}
-      {{code-mirror value=dagInfoContextDesc mode=dagInfoContextType classNames='additional-dag-info'}}
+{{#if appContext}}
+  <div class='margin-small-vertical code-mirror-container'>
+    {{#bs-panel heading=appContextHeading collapsible=false dismiss=false type='info'}}
+      {{code-mirror value=appContext mode=appInfoContextType classNames='additional-dag-info'}}
     {{/bs-panel}}
   </div>
 {{/if}}


Mime
View raw message