tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bi...@apache.org
Subject git commit: TEZ-884. Add parameter checking for context related user API's (Tsuyoshi Ozawa via bikas)
Date Mon, 03 Mar 2014 18:23:43 GMT
Repository: incubator-tez
Updated Branches:
  refs/heads/master ae84f1d23 -> 2ff672075


TEZ-884. Add parameter checking for context related user API's (Tsuyoshi Ozawa via 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/2ff67207
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tez/tree/2ff67207
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tez/diff/2ff67207

Branch: refs/heads/master
Commit: 2ff672075a5ab2a364e9d3b3ffcf6fa8400a3ca9
Parents: ae84f1d
Author: Bikas Saha <bikas@apache.org>
Authored: Mon Mar 3 10:23:41 2014 -0800
Committer: Bikas Saha <bikas@apache.org>
Committed: Mon Mar 3 10:23:41 2014 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/tez/dag/app/DAGAppMaster.java |  2 ++
 .../java/org/apache/tez/dag/app/dag/impl/Edge.java     |  7 ++++++-
 .../dag/app/dag/impl/OutputCommitterContextImpl.java   |  8 +++++++-
 .../dag/impl/TezRootInputInitializerContextImpl.java   |  7 +++++++
 .../org/apache/tez/dag/app/dag/impl/VertexManager.java |  7 +++++++
 .../org/apache/tez/dag/app/dag/impl/TestDAGImpl.java   |  4 ++++
 .../apache/tez/dag/app/dag/impl/TestVertexImpl.java    |  3 +++
 .../org/apache/tez/runtime/api/impl/EventMetaData.java |  7 ++++++-
 .../java/org/apache/tez/runtime/api/impl/TaskSpec.java | 13 +++++++++++--
 .../tez/runtime/api/impl/TezInputContextImpl.java      |  8 +++++++-
 .../tez/runtime/api/impl/TezOutputContextImpl.java     |  6 +++++-
 .../tez/runtime/api/impl/TezProcessorContextImpl.java  |  5 ++++-
 .../tez/runtime/api/impl/TezTaskContextImpl.java       | 10 ++++++++++
 .../library/output/TestOnFileUnorderedKVOutput.java    |  2 +-
 14 files changed, 80 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
index a481aaa..1ce07fb 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.dag.app;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -1016,6 +1017,7 @@ public class DAGAppMaster extends AbstractService {
     private final Lock wLock = rwLock.writeLock();
     private final EventHandler eventHandler;
     public RunningAppContext(Configuration config) {
+      checkNotNull(config, "config is null");
       this.conf = config;
       this.eventHandler = dispatcher.getEventHandler();
     }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/Edge.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/Edge.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/Edge.java
index 7b4a120..aecb5d2 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/Edge.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/Edge.java
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.tez.dag.api.EdgeManager;
 import org.apache.tez.dag.api.EdgeManagerContext;
@@ -49,6 +50,7 @@ import org.apache.tez.runtime.api.impl.TezEvent;
 import org.apache.tez.runtime.api.impl.EventMetaData.EventProducerConsumerType;
 
 import com.google.common.collect.Maps;
+import static com.google.common.base.Preconditions.checkNotNull;
 
 public class Edge {
 
@@ -58,7 +60,10 @@ public class Edge {
     private final String destVertexName;
     private final byte[] userPayload;
 
-    EdgeManagerContextImpl(String srcVertexName, String destVertexName, byte[] userPayload)
{
+    EdgeManagerContextImpl(String srcVertexName, String destVertexName,
+        @Nullable byte[] userPayload) {
+      checkNotNull(srcVertexName, "srcVertexName is null");
+      checkNotNull(destVertexName, "destVertexName is null");
       this.srcVertexName = srcVertexName;
       this.destVertexName = destVertexName;
       this.userPayload = userPayload;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java
index 68c8835..070bd75 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java
@@ -18,6 +18,8 @@
 
 package org.apache.tez.dag.app.dag.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import javax.annotation.Nullable;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.tez.runtime.api.OutputCommitterContext;
 
@@ -35,7 +37,11 @@ public class OutputCommitterContextImpl implements OutputCommitterContext
{
       String dagName,
       String vertexName,
       String outputName,
-      byte[] userPayload) {
+      @Nullable byte[] userPayload) {
+    checkNotNull(applicationId, "applicationId is null");
+    checkNotNull(dagName, "dagName is null");
+    checkNotNull(vertexName, "vertexName is null");
+    checkNotNull(outputName, "outputName is null");
     this.applicationId = applicationId;
     this.dagAttemptNumber = dagAttemptNumber;
     this.dagName = dagName;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TezRootInputInitializerContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TezRootInputInitializerContextImpl.java
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TezRootInputInitializerContextImpl.java
index c55142f..5ea02b8 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TezRootInputInitializerContextImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TezRootInputInitializerContextImpl.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.dag.app.dag.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.tez.dag.api.InputDescriptor;
@@ -42,6 +43,12 @@ public class TezRootInputInitializerContextImpl implements
       String dagName, String vertexName, String inputName,
       InputDescriptor inputDescriptor, int numTasks, int numClusterNodes,
       Resource vertexTaskResource, Resource totalResource) {
+    checkNotNull(vertexID, "vertexID is null");
+    checkNotNull(dagName, "dagName is null");
+    checkNotNull(inputName, "inputName is null");
+    checkNotNull(inputDescriptor, "inputDescriptor is null");
+    checkNotNull(vertexTaskResource, "numTasks is null");
+    checkNotNull(totalResource, "totalResource is null");
     this.vertexID = vertexID;
     this.dagName = dagName;
     this.inputName = inputName;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/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 4b110b2..e08e7ed 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
@@ -18,6 +18,7 @@
 
 package org.apache.tez.dag.app.dag.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.List;
@@ -179,6 +180,9 @@ public class VertexManager {
   
   public VertexManager(VertexManagerPlugin plugin, 
       Vertex managedVertex, AppContext appContext) {
+    checkNotNull(plugin, "plugin is null");
+    checkNotNull(managedVertex, "managedVertex is null");
+    checkNotNull(appContext, "appContext is null");
     this.plugin = plugin;
     this.managedVertex = managedVertex;
     this.appContext = appContext;
@@ -186,6 +190,9 @@ public class VertexManager {
   
   public VertexManager(VertexManagerPluginDescriptor pluginDesc, 
       Vertex managedVertex, AppContext appContext) {
+    checkNotNull(pluginDesc, "pluginDesc is null");
+    checkNotNull(managedVertex, "managedVertex is null");
+    checkNotNull(appContext, "appContext is null");
     this.pluginDesc = pluginDesc;
     this.managedVertex = managedVertex;
     this.appContext = appContext;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java
index 1b66a4b..60c7b31 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java
@@ -592,6 +592,7 @@ public class TestDAGImpl {
     historyEventHandler = mock(HistoryEventHandler.class);
     doReturn(conf).when(appContext).getAMConf();
     doReturn(appAttemptId).when(appContext).getApplicationAttemptId();
+    doReturn(appAttemptId.getApplicationId()).when(appContext).getApplicationID();
     doReturn(dagId).when(appContext).getCurrentDAGID();
     doReturn(historyEventHandler).when(appContext).getHistoryHandler();
     dag = new DAGImpl(dagId, conf, dagPlan,
@@ -608,6 +609,7 @@ public class TestDAGImpl {
     doReturn(conf).when(mrrAppContext).getAMConf();
     doReturn(mrrDag).when(mrrAppContext).getCurrentDAG();
     doReturn(appAttemptId).when(mrrAppContext).getApplicationAttemptId();
+    doReturn(appAttemptId.getApplicationId()).when(mrrAppContext).getApplicationID();
     doReturn(historyEventHandler).when(mrrAppContext).getHistoryHandler();
     groupAppContext = mock(AppContext.class);
     groupDagId = TezDAGID.getInstance(appAttemptId.getApplicationId(), 3);
@@ -619,6 +621,8 @@ public class TestDAGImpl {
     doReturn(conf).when(groupAppContext).getAMConf();
     doReturn(groupDag).when(groupAppContext).getCurrentDAG();
     doReturn(appAttemptId).when(groupAppContext).getApplicationAttemptId();
+    doReturn(appAttemptId.getApplicationId())
+        .when(groupAppContext).getApplicationID();
     doReturn(historyEventHandler).when(groupAppContext).getHistoryHandler();
     taskEventDispatcher = new TaskEventDispatcher();
     dispatcher.register(TaskEventType.class, taskEventDispatcher);

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
index 1a14b15..d435bda 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
@@ -1191,6 +1191,7 @@ public class TestVertexImpl {
   }
 
   public void setupPostDagCreation() {
+    String dagName = "dag0";
     dispatcher = new DrainDispatcher();
     appContext = mock(AppContext.class);
     historyEventHandler = mock(HistoryEventHandler.class);
@@ -1203,7 +1204,9 @@ public class TestVertexImpl {
     }
     DAG dag = mock(DAG.class);
     doReturn(ugi).when(dag).getDagUGI();
+    doReturn(dagName).when(dag).getName();
     doReturn(appAttemptId).when(appContext).getApplicationAttemptId();
+    doReturn(appAttemptId.getApplicationId()).when(appContext).getApplicationID();
     doReturn(dag).when(appContext).getCurrentDAG();
     doReturn(conf).when(appContext).getAMConf();
     doReturn(new Credentials()).when(dag).getCredentials();

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/EventMetaData.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/EventMetaData.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/EventMetaData.java
index 77d266a..c05ec57 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/EventMetaData.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/EventMetaData.java
@@ -18,10 +18,12 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.util.StringInterner;
 import org.apache.tez.dag.records.TezTaskAttemptID;
@@ -65,7 +67,10 @@ public class EventMetaData implements Writable {
 
   public EventMetaData(EventProducerConsumerType generator,
       String taskVertexName, String edgeVertexName,
-      TezTaskAttemptID taskAttemptID) {
+      @Nullable TezTaskAttemptID taskAttemptID) {
+    checkNotNull(generator, "generator is null");
+    checkNotNull(taskVertexName, "taskVertexName is null");
+    checkNotNull(edgeVertexName, "edgeVertexName is null");
     this.producerConsumerType = generator;
     this.taskVertexName = StringInterner.weakIntern(taskVertexName);
     this.edgeVertexName = StringInterner.weakIntern(edgeVertexName);

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TaskSpec.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TaskSpec.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TaskSpec.java
index 6466cdd..3469068 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TaskSpec.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TaskSpec.java
@@ -17,12 +17,16 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.util.StringInterner;
 import org.apache.tez.dag.api.ProcessorDescriptor;
@@ -47,8 +51,13 @@ public class TaskSpec implements Writable {
       String dagName, String vertexName,
       ProcessorDescriptor processorDescriptor,
       List<InputSpec> inputSpecList, List<OutputSpec> outputSpecList, 
-      List<GroupInputSpec> groupInputSpecList) {
-    // TODO: TEZ-884 null check
+      @Nullable List<GroupInputSpec> groupInputSpecList) {
+    checkNotNull(taskAttemptID, "taskAttemptID is null");
+    checkNotNull(dagName, "dagName is null");
+    checkNotNull(vertexName, "vertexName is null");
+    checkNotNull(processorDescriptor, "processorDescriptor is null");
+    checkNotNull(inputSpecList, "inputSpecList is null");
+    checkNotNull(outputSpecList, "outputSpecList is null");
     this.taskAttemptId = taskAttemptID;
     this.dagName = StringInterner.weakIntern(dagName);
     this.vertexName = StringInterner.weakIntern(vertexName);

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
index c138a58..1daf211 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
@@ -18,11 +18,13 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.tez.common.counters.TezCounters;
@@ -51,7 +53,7 @@ public class TezInputContextImpl extends TezTaskContextImpl
   public TezInputContextImpl(Configuration conf, int appAttemptNumber,
       TezUmbilical tezUmbilical, String dagName, String taskVertexName,
       String sourceVertexName, TezTaskAttemptID taskAttemptID,
-      TezCounters counters, int inputIndex, byte[] userPayload,
+      TezCounters counters, int inputIndex, @Nullable byte[] userPayload,
       RuntimeTask runtimeTask, Map<String, ByteBuffer> serviceConsumerMetadata,
       Map<String, String> auxServiceEnv, MemoryDistributor memDist,
       InputDescriptor inputDescriptor,  Input input, InputReadyTracker inputReadyTracker)
{
@@ -59,6 +61,10 @@ public class TezInputContextImpl extends TezTaskContextImpl
         wrapCounters(counters, taskVertexName, sourceVertexName, conf),
         runtimeTask, tezUmbilical, serviceConsumerMetadata,
         auxServiceEnv, memDist, inputDescriptor);
+    checkNotNull(inputIndex, "inputIndex is null");
+    checkNotNull(sourceVertexName, "sourceVertexName is null");
+    checkNotNull(input, "input is null");
+    checkNotNull(inputReadyTracker, "inputReadyTracker is null");
     this.userPayload = userPayload;
     this.inputIndex = inputIndex;
     this.sourceVertexName = sourceVertexName;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
index 1a2cfcb..6ba8581 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
@@ -18,11 +18,13 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.tez.common.counters.TezCounters;
@@ -49,7 +51,7 @@ public class TezOutputContextImpl extends TezTaskContextImpl
       String taskVertexName,
       String destinationVertexName,
       TezTaskAttemptID taskAttemptID, TezCounters counters, int outputIndex,
-      byte[] userPayload, RuntimeTask runtimeTask,
+      @Nullable byte[] userPayload, RuntimeTask runtimeTask,
       Map<String, ByteBuffer> serviceConsumerMetadata,
       Map<String, String> auxServiceEnv, MemoryDistributor memDist,
       OutputDescriptor outputDescriptor) {
@@ -57,6 +59,8 @@ public class TezOutputContextImpl extends TezTaskContextImpl
         wrapCounters(counters, taskVertexName, destinationVertexName, conf),
         runtimeTask, tezUmbilical, serviceConsumerMetadata,
         auxServiceEnv, memDist, outputDescriptor);
+    checkNotNull(outputIndex, "outputIndex is null");
+    checkNotNull(destinationVertexName, "destinationVertexName is null");
     this.userPayload = userPayload;
     this.outputIndex = outputIndex;
     this.destinationVertexName = destinationVertexName;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
index 2f9ebfd..091dbdc 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -25,6 +26,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Nullable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -50,13 +52,14 @@ public class TezProcessorContextImpl extends TezTaskContextImpl implements
TezPr
   public TezProcessorContextImpl(Configuration conf, int appAttemptNumber,
       TezUmbilical tezUmbilical, String dagName, String vertexName,
       TezTaskAttemptID taskAttemptID, TezCounters counters,
-      byte[] userPayload, RuntimeTask runtimeTask,
+      @Nullable byte[] userPayload, RuntimeTask runtimeTask,
       Map<String, ByteBuffer> serviceConsumerMetadata,
       Map<String, String> auxServiceEnv, MemoryDistributor memDist,
       ProcessorDescriptor processorDescriptor, InputReadyTracker inputReadyTracker) {
     super(conf, appAttemptNumber, dagName, vertexName, taskAttemptID,
         counters, runtimeTask, tezUmbilical, serviceConsumerMetadata,
         auxServiceEnv, memDist, processorDescriptor);
+    checkNotNull(inputReadyTracker, "inputReadyTracker is null");
     this.userPayload = userPayload;
     this.sourceInfo = new EventMetaData(EventProducerConsumerType.PROCESSOR,
         taskVertexName, "", taskAttemptID);

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
index 53f6a56..e041c23 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Map;
@@ -65,6 +66,15 @@ public abstract class TezTaskContextImpl implements TezTaskContext {
       TezUmbilical tezUmbilical, Map<String, ByteBuffer> serviceConsumerMetadata,
       Map<String, String> auxServiceEnv, MemoryDistributor memDist,
       TezEntityDescriptor descriptor) {
+    checkNotNull(conf, "conf is null");
+    checkNotNull(dagName, "dagName is null");
+    checkNotNull(taskVertexName, "taskVertexName is null");
+    checkNotNull(taskAttemptID, "taskAttemptId is null");
+    checkNotNull(counters, "counters is null");
+    checkNotNull(runtimeTask, "runtimeTask is null");
+    checkNotNull(auxServiceEnv, "auxServiceEnv is null");
+    checkNotNull(memDist, "memDist is null");
+    checkNotNull(descriptor, "descriptor is null");
     this.conf = conf;
     this.dagName = dagName;
     this.taskVertexName = taskVertexName;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/2ff67207/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
index 61d7019..64a3bdf 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
@@ -109,7 +109,7 @@ public class TestOnFileUnorderedKVOutput {
     TezTaskAttemptID taskAttemptID = TezTaskAttemptID.getInstance(taskID, 1);
     TezCounters counters = new TezCounters();
     byte[] userPayload = TezUtils.createUserPayloadFromConf(conf);
-    RuntimeTask runtimeTask = null;
+    RuntimeTask runtimeTask = mock(RuntimeTask.class);
     
     int shufflePort = 2112;
     Map<String, String> auxEnv = new HashMap<String, String>();


Mime
View raw message