Repository: tez
Updated Branches:
  refs/heads/master 46bc363cd -> c35e5cc86


TEZ-2899. Tez UI: DAG getting created with huge horizontal gap in between 
vertices


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

Branch: refs/heads/master
Commit: 8000b5cb0d3905c8d9b10a640a7e0cdb488dc116
Parents: 46bc363
Author: Jonathan Eagles <[email protected]>
Authored: Mon Oct 26 10:26:20 2015 -0500
Committer: Jonathan Eagles <[email protected]>
Committed: Mon Oct 26 10:26:20 2015 -0500

----------------------------------------------------------------------
 .../components/dag-view/data-processor.js       | 22 +++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/8000b5cb/tez-ui/src/main/webapp/app/scripts/components/dag-view/data-processor.js
----------------------------------------------------------------------
diff --git 
a/tez-ui/src/main/webapp/app/scripts/components/dag-view/data-processor.js 
b/tez-ui/src/main/webapp/app/scripts/components/dag-view/data-processor.js
index e145fc1..58a72de 100644
--- a/tez-ui/src/main/webapp/app/scripts/components/dag-view/data-processor.js
+++ b/tez-ui/src/main/webapp/app/scripts/components/dag-view/data-processor.js
@@ -498,6 +498,26 @@ App.DagViewComponent.dataProcessor = (function (){
   }
 
   /**
+   * Part of step 1
+   * To remove recurring vertices in the tree
+   * @param vertex {Object} root vertex
+   */
+  function _normalizeVertexTree(vertex) {
+    var children = vertex.get('children');
+
+    if(children) {
+      children = children.filter(function (child) {
+        _normalizeVertexTree(child);
+        return child.get('type') != 'vertex' || child.get('treeParent') == 
vertex;
+      });
+
+      vertex._setChildren(children);
+    }
+
+    return vertex;
+  }
+
+  /**
    * Step 2: Recursive awesomeness
    * Attaches outputs into the primary structure created in step 1. As outputs 
must be represented
    * in the same level of the vertex's parent. They are added as children of 
its parent's parent.
@@ -717,7 +737,7 @@ App.DagViewComponent.dataProcessor = (function (){
       }
 
       dummy._setChildren(centericMap(_data.rootVertices, function (vertex) {
-        return _treefyData(vertex, 2);
+        return _normalizeVertexTree(_treefyData(vertex, 2));
       }));
 
       _addOutputs(root);

Reply via email to