ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject git commit: AMBARI-5641. Some operators in the view look very small relative to others. (srimanth)
Date Wed, 30 Apr 2014 19:59:58 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk cf6e1f3a7 -> 3c799274a


AMBARI-5641. Some operators in the view look very small relative to others. (srimanth)


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

Branch: refs/heads/trunk
Commit: 3c799274aea8d73aa50a5d76fde32ee6573beee7
Parents: cf6e1f3
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Wed Apr 30 12:52:30 2014 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Wed Apr 30 12:53:26 2014 -0700

----------------------------------------------------------------------
 .../main/jobs/hive_job_details_tez_dag_view.js  | 27 ++++++++++++++++----
 1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3c799274/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js b/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js
index 4761fde..9d18559 100644
--- a/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js
+++ b/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js
@@ -348,6 +348,7 @@ App.MainHiveJobDetailsTezDagView = Em.View.extend({
     var dagVisualModel = this.get('dagVisualModel');
     var selectedVertex = this.get('selectedVertex');
     var minVertexDuration = Number.MAX_VALUE;
+    var maxVertexDuration = Number.MIN_VALUE;
 
     //
     // CALCULATE DEPTH - BFS to get correct graph depth
@@ -407,6 +408,9 @@ App.MainHiveJobDetailsTezDagView = Em.View.extend({
         if (node.duration < minVertexDuration && node.duration > 0) {
           minVertexDuration = node.duration;
         }
+        if (node.duration > maxVertexDuration && node.duration > 0) {
+          maxVertexDuration = node.duration;
+        }
         vertexIdToNode[vertex.get('id')] = node;
         depthToNodes[node.depth].push(node);
       } else {
@@ -521,7 +525,7 @@ App.MainHiveJobDetailsTezDagView = Em.View.extend({
       var maxNodeHeight = 0;
       for ( var nodeIndex = 0; nodeIndex < nodes.length; nodeIndex++) {
         var node = nodes[nodeIndex];
-        var nodeDim = this.getNodeCalculatedDimensions(node, minVertexDuration);
+        var nodeDim = this.getNodeCalculatedDimensions(node, minVertexDuration, maxVertexDuration);
         node.drawWidth = nodeDim.drawWidth;
         node.drawHeight = nodeDim.drawHeight;
         node.scale = nodeDim.scale;
@@ -542,7 +546,7 @@ App.MainHiveJobDetailsTezDagView = Em.View.extend({
           // fraction of parentage
           var childrenWidth = 0;
           node.children.forEach(function(child) {
-            var childDim = self.getNodeCalculatedDimensions(child, minVertexDuration);
+            var childDim = self.getNodeCalculatedDimensions(child, minVertexDuration, maxVertexDuration);
             childrenWidth += ((childDim.width + xGap) / child.parents.length);
           });
           updateNodeEffectiveWidth(node, Math.max(childrenWidth, (node.width+xGap)));
@@ -905,13 +909,13 @@ App.MainHiveJobDetailsTezDagView = Em.View.extend({
    * {
    *  width: 360, // Scaled width of the node
    *  height: 80, // Scaled height of the node
-   *  scale: 2, // Scale used on vertex dimensions. Quickest vertex is scaled to 1.
+   *  scale: 2, // Scale used on vertex dimensions. Quickest vertex is scaled to 1 and slowest
vertex is scaled to 10.
    *  drawWidth: 180, // Width of actual drawing (that will be scaled)
    *  drawHeight: 40 // Height of actual drawing (that will be scaled)
    * }
    * </code>
    */
-  getNodeCalculatedDimensions : function(node, minVertexDuration) {
+  getNodeCalculatedDimensions : function(node, minVertexDuration, maxVertexDuration) {
     var size = {
       width : 180,
       height : 40,
@@ -923,7 +927,20 @@ App.MainHiveJobDetailsTezDagView = Em.View.extend({
       var opsHeight = Math.ceil(node.operations.length / 3);
       size.drawHeight += (opsHeight * 20);
     }
-    size.scale = (minVertexDuration < Number.MAX_VALUE && node.duration > 0)
? (node.duration / minVertexDuration) : 1;
+    if (minVertexDuration < Number.MAX_VALUE && maxVertexDuration > Number.MIN_VALUE
&&
+        minVertexDuration < maxVertexDuration && node.duration > 0) {
+      var MAXSCALE = 100;
+      // Upto scale of 100 the actual ratio of durations will be used.
+      // If scale is exceeding 100, some nodes will become too small (not visible) in comparison
with others.
+      // Then we fit node scaling into 1 to 100.
+      var minMaxRatio = maxVertexDuration / minVertexDuration;
+      if (minMaxRatio > MAXSCALE) {
+        size.scale = ((maxVertexDuration - node.duration) + MAXSCALE * (node.duration - minVertexDuration));
+        size.scale = size.scale / (maxVertexDuration - minVertexDuration);
+      } else {
+        size.scale = (minVertexDuration < Number.MAX_VALUE && node.duration >
0) ? (node.duration / minVertexDuration) : 1;
+      }
+    }
     if (size.scale < 1) {
       size.scale = 1;
     }


Mime
View raw message