tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bi...@apache.org
Subject git commit: TEZ-1318 addendum. Simplify Vertex Constructor (bikas)
Date Sun, 10 Aug 2014 02:53:08 GMT
Repository: tez
Updated Branches:
  refs/heads/master f184b1a0e -> dadd4e048


TEZ-1318 addendum. Simplify Vertex Constructor (bikas)


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

Branch: refs/heads/master
Commit: dadd4e048c7aa630ead907783af2d9fdb74db786
Parents: f184b1a
Author: Bikas Saha <bikas@apache.org>
Authored: Sat Aug 9 19:53:02 2014 -0700
Committer: Bikas Saha <bikas@apache.org>
Committed: Sat Aug 9 19:53:02 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/tez/dag/api/Vertex.java     | 31 +++++++++++++-------
 1 file changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/dadd4e04/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java b/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java
index 654d4a1..66c708a 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java
@@ -80,15 +80,7 @@ public class Vertex {
       ProcessorDescriptor processorDescriptor,
       int parallelism,
       Resource taskResource) {
-    this.vertexName = vertexName;
-    this.processorDescriptor = processorDescriptor;
-    this.parallelism = parallelism;
-    this.taskResource = taskResource;
-    if (parallelism < -1) {
-      throw new IllegalArgumentException(
-          "Parallelism should be -1 if determined by the AM"
-          + ", otherwise should be >= 0");
-    }
+    this(vertexName, processorDescriptor, parallelism, taskResource, false);
   }
   
   /**
@@ -112,7 +104,7 @@ public class Vertex {
    *          reconfigurations.
    */
   public Vertex(String vertexName, ProcessorDescriptor processorDescriptor, int parallelism)
{
-    this(vertexName, processorDescriptor, parallelism, null);
+    this(vertexName, processorDescriptor, parallelism, null, true);
   }
   
   /**
@@ -135,6 +127,25 @@ public class Vertex {
   public Vertex(String vertexName, ProcessorDescriptor processorDescriptor) {
     this(vertexName, processorDescriptor, -1);
   }
+  
+  private Vertex(String vertexName,
+      ProcessorDescriptor processorDescriptor,
+      int parallelism,
+      Resource taskResource,
+      boolean allowIncomplete) {
+    this.vertexName = vertexName;
+    this.processorDescriptor = processorDescriptor;
+    this.parallelism = parallelism;
+    this.taskResource = taskResource;
+    if (parallelism < -1) {
+      throw new IllegalArgumentException(
+          "Parallelism should be -1 if determined by the AM"
+          + ", otherwise should be >= 0");
+    }
+    if (!allowIncomplete && taskResource == null) {
+      throw new IllegalArgumentException("Resource cannot be null");
+    }
+  }  
 
   /**
    * Get the vertex name


Mime
View raw message