tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bi...@apache.org
Subject git commit: TEZ-274- Failing tests in TestDAGVerify (bikas)
Date Fri, 28 Jun 2013 18:53:53 GMT
Updated Branches:
  refs/heads/master a059ad48f -> 81c0ded1e


TEZ-274- Failing tests in TestDAGVerify (bikas)


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

Branch: refs/heads/master
Commit: 81c0ded1e9f38bc4ed5a6f9c8156e22f9cded248
Parents: a059ad4
Author: Bikas Saha <bikas@apache.org>
Authored: Fri Jun 28 11:50:14 2013 -0700
Committer: Bikas Saha <bikas@apache.org>
Committed: Fri Jun 28 11:50:14 2013 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/tez/dag/api/DAG.java   | 10 +++++
 .../org/apache/tez/dag/api/TestDAGVerify.java   | 40 ++++++++++++++++++--
 2 files changed, 46 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/81c0ded1/tez-dag-api/src/main/java/org/apache/tez/dag/api/DAG.java
----------------------------------------------------------------------
diff --git a/tez-dag-api/src/main/java/org/apache/tez/dag/api/DAG.java b/tez-dag-api/src/main/java/org/apache/tez/dag/api/DAG.java
index bfe62ae..8fb665a 100644
--- a/tez-dag-api/src/main/java/org/apache/tez/dag/api/DAG.java
+++ b/tez-dag-api/src/main/java/org/apache/tez/dag/api/DAG.java
@@ -104,10 +104,13 @@ public class DAG { // FIXME rename to Topology
     int lowlink; //for Tarjan's algorithm
     boolean onstack; //for Tarjan's algorithm 
     
+    int outDegree;
+    
     private AnnotatedVertex(Vertex v){
        this.v = v;
        index = -1;
        lowlink = -1;
+       outDegree = 0;
     }
   }
 
@@ -165,12 +168,19 @@ public class DAG { // FIXME rename to Topology
 
     if(restricted){
       for(Edge e : edges){
+        vertexMap.get(e.getInputVertex().getVertexName()).outDegree++;
         if (e.getEdgeProperty().getConnectionPattern() != 
             ConnectionPattern.BIPARTITE) {
           throw new IllegalStateException(
               "Unsupported connection pattern on edge. " + e);
         }
       }
+      for(AnnotatedVertex av: vertexMap.values()){
+        if (av.outDegree > 1) {
+          throw new IllegalStateException("Vertex has outDegree>1: "
+              + av.v.getVertexName());
+        }
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/81c0ded1/tez-dag-api/src/test/java/org/apache/tez/dag/api/TestDAGVerify.java
----------------------------------------------------------------------
diff --git a/tez-dag-api/src/test/java/org/apache/tez/dag/api/TestDAGVerify.java b/tez-dag-api/src/test/java/org/apache/tez/dag/api/TestDAGVerify.java
index 7d8061d..2a7b8ff 100644
--- a/tez-dag-api/src/test/java/org/apache/tez/dag/api/TestDAGVerify.java
+++ b/tez-dag-api/src/test/java/org/apache/tez/dag/api/TestDAGVerify.java
@@ -193,7 +193,7 @@ public class TestDAGVerify {
   //   |  |
   //    v3
   @Test
-  public void BinaryInput() {
+  public void BinaryInputDisallowed() {
     IllegalStateException ex=null;
     try {
       Vertex v1 = new Vertex("v1",
@@ -203,10 +203,10 @@ public class TestDAGVerify {
           new ProcessorDescriptor("MapProcessor", null),
           dummyTaskCount, dummyTaskResource);
       Vertex v3 = new Vertex("v3",
-          new ProcessorDescriptor("MapProcessor", null),
+          new ProcessorDescriptor("ReduceProcessor", null),
           dummyTaskCount, dummyTaskResource);
       Edge e1 = new Edge(v1, v3,
-          new EdgeProperty(ConnectionPattern.BIPARTITE, SourceType.STABLE,
+          new EdgeProperty(ConnectionPattern.ONE_TO_ONE, SourceType.STABLE,
               new OutputDescriptor("dummy output class", null),
               new InputDescriptor("dummy input class", null)));
       Edge e2 = new Edge(v2, v3,
@@ -226,7 +226,39 @@ public class TestDAGVerify {
     }
     Assert.assertNotNull(ex);
     System.out.println(ex.getMessage());
-    Assert.assertTrue(ex.getMessage().startsWith("Vertex has inDegree>1"));
+    Assert.assertTrue(ex.getMessage().startsWith(
+        "Unsupported connection pattern on edge"));
+  }
+
+  //  v1  v2
+  //   |  |
+  //    v3
+  @Test
+  public void BinaryInputAllowed() {
+    Vertex v1 = new Vertex("v1",
+        new ProcessorDescriptor("MapProcessor", null),
+        dummyTaskCount, dummyTaskResource);
+    Vertex v2 = new Vertex("v2",
+        new ProcessorDescriptor("MapProcessor", null),
+        dummyTaskCount, dummyTaskResource);
+    Vertex v3 = new Vertex("v3",
+        new ProcessorDescriptor("ReduceProcessor", null),
+        dummyTaskCount, dummyTaskResource);
+    Edge e1 = new Edge(v1, v3,
+        new EdgeProperty(ConnectionPattern.BIPARTITE, SourceType.STABLE,
+            new OutputDescriptor("dummy output class", null),
+            new InputDescriptor("dummy input class", null)));
+    Edge e2 = new Edge(v2, v3,
+        new EdgeProperty(ConnectionPattern.BIPARTITE, SourceType.STABLE,
+            new OutputDescriptor("dummy output class", null),
+            new InputDescriptor("dummy input class", null)));
+    DAG dag = new DAG("testDag");
+    dag.addVertex(v1);
+    dag.addVertex(v2);
+    dag.addVertex(v3);
+    dag.addEdge(e1);
+    dag.addEdge(e2);
+    dag.verify();
   }
 
   //   v1


Mime
View raw message