Repository: tez Updated Branches: refs/heads/branch-0.7 45aa72dbf -> e6488d936
TEZ-2899. Tez UI: DAG getting created with huge horizontal gap in between vertices (cherry picked from commit 8000b5cb0d3905c8d9b10a640a7e0cdb488dc116) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/ca7c1e76 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/ca7c1e76 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/ca7c1e76 Branch: refs/heads/branch-0.7 Commit: ca7c1e76e26caa64dc94611f0e190b192f7dab56 Parents: 45aa72d Author: Jonathan Eagles <[email protected]> Authored: Mon Oct 26 10:26:20 2015 -0500 Committer: Jonathan Eagles <[email protected]> Committed: Mon Oct 26 10:27:54 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/ca7c1e76/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);
