tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bi...@apache.org
Subject git commit: TEZ-755. Change VertexManagerPlugin.initialize and context to be consistent with the rest of the context objects (bikas)
Date Fri, 14 Feb 2014 18:18:23 GMT
Updated Branches:
  refs/heads/master 199ea91cd -> 86160fed6


TEZ-755. Change VertexManagerPlugin.initialize and context to be consistent with the rest
of the context objects (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/86160fed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tez/tree/86160fed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tez/diff/86160fed

Branch: refs/heads/master
Commit: 86160fed67f88eccf24b60065bd727147770535a
Parents: 199ea91
Author: Bikas Saha <bikas@apache.org>
Authored: Fri Feb 14 10:18:12 2014 -0800
Committer: Bikas Saha <bikas@apache.org>
Committed: Fri Feb 14 10:18:12 2014 -0800

----------------------------------------------------------------------
 .../java/org/apache/tez/dag/api/VertexManagerPlugin.java    | 3 +--
 .../org/apache/tez/dag/api/VertexManagerPluginContext.java  | 6 ++++++
 .../tez/dag/app/dag/impl/ImmediateStartVertexManager.java   | 2 +-
 .../apache/tez/dag/app/dag/impl/RootInputVertexManager.java | 2 +-
 .../java/org/apache/tez/dag/app/dag/impl/VertexManager.java | 9 +++++++--
 .../tez/dag/library/vertexmanager/ShuffleVertexManager.java | 4 ++--
 .../dag/library/vertexmanager/TestShuffleVertexManager.java | 3 ++-
 7 files changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/86160fed/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPlugin.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPlugin.java b/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPlugin.java
index 602da3d..438b2dd 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPlugin.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPlugin.java
@@ -34,10 +34,9 @@ public interface VertexManagerPlugin {
   /**
    * Initialize the plugin. Called when the vertex is initializing. This happens 
    * after all source vertices and inputs have initialized
-   * @param payload
    * @param context
    */
-  public void initialize(byte[] payload, VertexManagerPluginContext context);
+  public void initialize(VertexManagerPluginContext context);
 
   /**
    * Notification that the vertex is ready to start running tasks

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/86160fed/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
b/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
index 47d2a22..ed02e0f 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
@@ -41,6 +41,12 @@ public interface VertexManagerPluginContext {
   public String getVertexName();
   
   /**
+   * Get the payload set for the plugin
+   * @return user payload
+   */
+  public byte[] getUserPayload();
+  
+  /**
    * Get the number of tasks in the given vertex
    * @param vertexName
    * @return Total number of tasks in this vertex

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/86160fed/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/ImmediateStartVertexManager.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/ImmediateStartVertexManager.java
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/ImmediateStartVertexManager.java
index 92c1938..af128ba 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/ImmediateStartVertexManager.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/ImmediateStartVertexManager.java
@@ -53,7 +53,7 @@ public class ImmediateStartVertexManager implements VertexManagerPlugin
{
   }
 
   @Override
-  public void initialize(byte[] payload, VertexManagerPluginContext context) {
+  public void initialize(VertexManagerPluginContext context) {
     this.context = context;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/86160fed/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/RootInputVertexManager.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/RootInputVertexManager.java
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/RootInputVertexManager.java
index 7c0991c..8ca6dc2 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/RootInputVertexManager.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/RootInputVertexManager.java
@@ -62,7 +62,7 @@ public class RootInputVertexManager implements VertexManagerPlugin {
   }
 
   @Override
-  public void initialize(byte[] payload, VertexManagerPluginContext context) {
+  public void initialize(VertexManagerPluginContext context) {
     this.context = context;
     Set<String> inputs = this.context.getVertexInputNames();
     this.destInfoMap = Maps.newHashMapWithExpectedSize(inputs.size());

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/86160fed/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
index d7b2ad2..106c868 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
@@ -48,6 +48,7 @@ public class VertexManager {
   VertexManagerPlugin plugin;
   Vertex managedVertex;
   VertexManagerPluginContextImpl pluginContext;
+  byte[] payload = null;
   AppContext appContext;
   
   class VertexManagerPluginContextImpl implements VertexManagerPluginContext {
@@ -100,6 +101,11 @@ public class VertexManager {
       managedVertex.setVertexLocationHint(locationHint);
     }
 
+    @Override
+    public byte[] getUserPayload() {
+      return payload;
+    }
+
   }
   
   public VertexManager(VertexManagerPlugin plugin, 
@@ -122,7 +128,6 @@ public class VertexManager {
   
   public void initialize() {
     pluginContext = new VertexManagerPluginContextImpl();
-    byte[] payload = null;
     if (pluginDesc != null) {
       plugin = RuntimeUtils.createClazzInstance(pluginDesc.getClassName());
       payload = pluginDesc.getUserPayload();
@@ -136,7 +141,7 @@ public class VertexManager {
         throw new TezUncheckedException(e);
       }
     }
-    plugin.initialize(payload, pluginContext);
+    plugin.initialize(pluginContext);
   }
 
   public void onVertexStarted(List<TezTaskAttemptID> completions) {

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/86160fed/tez-runtime-library/src/main/java/org/apache/tez/dag/library/vertexmanager/ShuffleVertexManager.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/dag/library/vertexmanager/ShuffleVertexManager.java
b/tez-runtime-library/src/main/java/org/apache/tez/dag/library/vertexmanager/ShuffleVertexManager.java
index 1ba5f32..79cde5c 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/dag/library/vertexmanager/ShuffleVertexManager.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/dag/library/vertexmanager/ShuffleVertexManager.java
@@ -445,10 +445,10 @@ public class ShuffleVertexManager implements VertexManagerPlugin {
   }
 
   @Override
-  public void initialize(byte[] payload, VertexManagerPluginContext context) {
+  public void initialize(VertexManagerPluginContext context) {
     Configuration conf;
     try {
-      conf = TezUtils.createConfFromUserPayload(payload);
+      conf = TezUtils.createConfFromUserPayload(context.getUserPayload());
     } catch (IOException e) {
       throw new TezUncheckedException(e);
     }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/86160fed/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java
b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java
index a4fbeda..4ee034c 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java
@@ -430,7 +430,8 @@ public class TestShuffleVertexManager {
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
-    manager.initialize(payload, context);
+    when(context.getUserPayload()).thenReturn(payload);
+    manager.initialize(context);
     return manager;
   }
 }


Mime
View raw message