Repository: tez
Updated Branches:
  refs/heads/branch-0.6 f8cabdc4c -> bc56e10fe


TEZ-2745. ClassNotFoundException of user code should fail dag (zjffdu)

(cherry picked from commit c644e6dbe056eec93f68a23cf6f7b04e3634f7c3)

Conflicts:
        CHANGES.txt
        tez-api/src/main/java/org/apache/tez/client/FrameworkClient.java
        tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
        tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/Edge.java
        tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
        tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java
        
tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
        
tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
        
tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java


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

Branch: refs/heads/branch-0.6
Commit: bc56e10fe91703980dc34df950ace3d0246706de
Parents: f8cabdc
Author: Jeff Zhang <[email protected]>
Authored: Fri Sep 4 22:16:08 2015 +0800
Committer: Jeff Zhang <[email protected]>
Committed: Fri Sep 4 23:08:14 2015 +0800

----------------------------------------------------------------------
 CHANGES.txt                                     |   2 +
 .../org/apache/tez/client/FrameworkClient.java  |   8 +-
 .../java/org/apache/tez/client/TezClient.java   |   3 +-
 .../org/apache/tez/common/ReflectionUtils.java  |  43 +++---
 .../tez/dag/api/TezReflectionException.java     |  35 +++++
 .../dag/api/client/TimelineReaderFactory.java   |  19 ++-
 .../apache/tez/common/TestReflectionUtils.java  |   3 +-
 .../org/apache/tez/dag/app/DAGAppMaster.java    |   1 -
 .../app/dag/RootInputInitializerManager.java    |   5 +-
 .../apache/tez/dag/app/dag/impl/DAGImpl.java    |  28 +++-
 .../org/apache/tez/dag/app/dag/impl/Edge.java   |  13 +-
 .../apache/tez/dag/app/dag/impl/VertexImpl.java |  29 +++-
 .../tez/dag/app/dag/impl/VertexManager.java     |  12 +-
 .../dag/app/rm/TaskSchedulerEventHandler.java   |   2 +-
 .../tez/dag/app/dag/impl/TestDAGImpl.java       | 101 +++++++++++++
 .../apache/tez/dag/app/dag/impl/TestEdge.java   |   3 +-
 .../tez/dag/app/dag/impl/TestVertexImpl.java    | 146 ++++++++++++++++++-
 .../TestHistoryEventsProtoConversion.java       |   7 +-
 .../tez/runtime/task/TestTaskExecution.java     |   2 +-
 .../hadoop/mapred/split/TezGroupedSplit.java    |  13 +-
 .../split/TezGroupedSplitsInputFormat.java      |  14 +-
 .../hadoop/mapreduce/split/TezGroupedSplit.java |  11 +-
 .../split/TezGroupedSplitsInputFormat.java      |  13 +-
 .../logging/ats/ATSHistoryLoggingService.java   |   3 +-
 .../runtime/LogicalIOProcessorRuntimeTask.java  |  11 +-
 .../common/resources/MemoryDistributor.java     |   4 +-
 .../common/resources/TestMemoryDistributor.java |  11 +-
 .../TestWeightedScalingMemoryDistributor.java   |   5 +-
 .../apache/tez/mapreduce/TestMRRJobsDAGApi.java |   3 +-
 29 files changed, 453 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1a0e221..8ef031f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@ Release 0.6.3: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES:
+  TEZ-2745. ClassNotFoundException of user code should fail dag
   TEZ-2752. logUnsuccessful completion in Attempt should write original finish
   time to ATS
   TEZ-2742. VertexImpl.finished() terminationCause hides member var of the
@@ -232,6 +233,7 @@ INCOMPATIBLE CHANGES
   TEZ-2552. CRC errors can cause job to run for very long time in large jobs.
 
 ALL CHANGES:
+  TEZ-2745. ClassNotFoundException of user code should fail dag
   TEZ-2752. logUnsuccessful completion in Attempt should write original finish
   time to ATS
   TEZ-2742. VertexImpl.finished() terminationCause hides member var of the

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-api/src/main/java/org/apache/tez/client/FrameworkClient.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/FrameworkClient.java 
b/tez-api/src/main/java/org/apache/tez/client/FrameworkClient.java
index 528987f..0207410 100644
--- a/tez-api/src/main/java/org/apache/tez/client/FrameworkClient.java
+++ b/tez-api/src/main/java/org/apache/tez/client/FrameworkClient.java
@@ -30,6 +30,8 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.tez.common.ReflectionUtils;
 import org.apache.tez.dag.api.TezConfiguration;
+import org.apache.tez.dag.api.TezReflectionException;
+import org.apache.tez.dag.api.TezUncheckedException;
 
 @Private
 public abstract class FrameworkClient {
@@ -38,7 +40,11 @@ public abstract class FrameworkClient {
 
     boolean isLocal = tezConf.getBoolean(TezConfiguration.TEZ_LOCAL_MODE, 
TezConfiguration.TEZ_LOCAL_MODE_DEFAULT);
     if (isLocal) {
-      return 
ReflectionUtils.createClazzInstance("org.apache.tez.client.LocalClient");
+      try {
+        return 
ReflectionUtils.createClazzInstance("org.apache.tez.client.LocalClient");
+      } catch (TezReflectionException e) {
+        throw new TezUncheckedException("Fail to create LocalClient", e);
+      }
     }
     return new TezYarnClient(YarnClient.createYarnClient());
   }

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-api/src/main/java/org/apache/tez/client/TezClient.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/TezClient.java 
b/tez-api/src/main/java/org/apache/tez/client/TezClient.java
index cd02ba1..6ea02eb 100644
--- a/tez-api/src/main/java/org/apache/tez/client/TezClient.java
+++ b/tez-api/src/main/java/org/apache/tez/client/TezClient.java
@@ -52,6 +52,7 @@ import org.apache.tez.dag.api.SessionNotRunning;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.TezConstants;
 import org.apache.tez.dag.api.TezException;
+import org.apache.tez.dag.api.TezReflectionException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.client.DAGClient;
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB;
@@ -319,7 +320,7 @@ public class TezClient {
         historyACLPolicyManager = ReflectionUtils.createClazzInstance(
             atsHistoryACLManagerClassName);
         historyACLPolicyManager.setConf(this.amConfig.getYarnConfiguration());
-      } catch (TezUncheckedException e) {
+      } catch (TezReflectionException e) {
         if (!amConfig.getTezConfiguration().getBoolean(
             TezConfiguration.TEZ_AM_ALLOW_DISABLED_TIMELINE_DOMAINS,
             TezConfiguration.TEZ_AM_ALLOW_DISABLED_TIMELINE_DOMAINS_DEFAULT)) {

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-api/src/main/java/org/apache/tez/common/ReflectionUtils.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/ReflectionUtils.java 
b/tez-api/src/main/java/org/apache/tez/common/ReflectionUtils.java
index f1eb0ae..4d89ed4 100644
--- a/tez-api/src/main/java/org/apache/tez/common/ReflectionUtils.java
+++ b/tez-api/src/main/java/org/apache/tez/common/ReflectionUtils.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.tez.dag.api.TezReflectionException;
 import org.apache.tez.dag.api.TezUncheckedException;
 
 @Private
@@ -36,55 +37,44 @@ public class ReflectionUtils {
   private static final Map<String, Class<?>> CLAZZ_CACHE = new 
ConcurrentHashMap<String, Class<?>>();
 
   @Private
-  public static Class<?> getClazz(String className) {
+  public static Class<?> getClazz(String className) throws 
TezReflectionException {
     Class<?> clazz = CLAZZ_CACHE.get(className);
     if (clazz == null) {
       try {
         clazz = Class.forName(className, true, 
Thread.currentThread().getContextClassLoader());
       } catch (ClassNotFoundException e) {
-        throw new TezUncheckedException("Unable to load class: " + className, 
e);
+        throw new TezReflectionException("Unable to load class: " + className, 
e);
       }
     }
     return clazz;
   }
 
-  private static <T> T getNewInstance(Class<T> clazz) {
+  private static <T> T getNewInstance(Class<T> clazz) throws 
TezReflectionException {
     T instance;
     try {
       instance = clazz.newInstance();
-    } catch (InstantiationException e) {
-      throw new TezUncheckedException(
-          "Unable to instantiate class with 0 arguments: " + clazz.getName(), 
e);
-    } catch (IllegalAccessException e) {
-      throw new TezUncheckedException(
+    } catch (Exception e) {
+      throw new TezReflectionException(
           "Unable to instantiate class with 0 arguments: " + clazz.getName(), 
e);
     }
     return instance;
   }
 
-  private static <T> T getNewInstance(Class<T> clazz, Class<?>[] 
parameterTypes, Object[] parameters) {
+  private static <T> T getNewInstance(Class<T> clazz, Class<?>[] 
parameterTypes, Object[] parameters)
+    throws TezReflectionException {
     T instance;
     try {
       Constructor<T> constructor = clazz.getConstructor(parameterTypes);
       instance = constructor.newInstance(parameters);
-    } catch (InstantiationException e) {
-      throw new TezUncheckedException(
-          "Unable to instantiate class with " + parameters.length + " 
arguments: " + clazz.getName(), e);
-    } catch (IllegalAccessException e) {
-      throw new TezUncheckedException(
-          "Unable to instantiate class with " + parameters.length + " 
arguments: " + clazz.getName(), e);
-    } catch (NoSuchMethodException e) {
-      throw new TezUncheckedException(
-          "Unable to instantiate class with " + parameters.length + " 
arguments: " + clazz.getName(), e);
-    } catch (InvocationTargetException e) {
-      throw new TezUncheckedException(
+    } catch (Exception e) {
+      throw new TezReflectionException(
           "Unable to instantiate class with " + parameters.length + " 
arguments: " + clazz.getName(), e);
     }
     return instance;
   }
 
   @Private
-  public static <T> T createClazzInstance(String className) {
+  public static <T> T createClazzInstance(String className) throws 
TezReflectionException {
     Class<?> clazz = getClazz(className);
     @SuppressWarnings("unchecked")
     T instance = (T) getNewInstance(clazz);
@@ -92,7 +82,8 @@ public class ReflectionUtils {
   }
 
   @Private
-  public static <T> T createClazzInstance(String className, Class<?>[] 
parameterTypes, Object[] parameters) {
+  public static <T> T createClazzInstance(String className, Class<?>[] 
parameterTypes, Object[] parameters)
+    throws TezReflectionException {
     Class<?> clazz = getClazz(className);
     @SuppressWarnings("unchecked")
     T instance = (T) getNewInstance(clazz, parameterTypes, parameters);
@@ -101,20 +92,20 @@ public class ReflectionUtils {
 
   @Private
   @SuppressWarnings("unchecked")
-  public static <T> T invokeMethod(Object target, Method method, Object... 
args) {
+  public static <T> T invokeMethod(Object target, Method method, Object... 
args) throws TezReflectionException {
     try {
       return (T) method.invoke(target, args);
     } catch (Exception e) {
-      throw new TezUncheckedException(e);
+      throw new TezReflectionException(e);
     }
   }
 
   @Private
-  public static Method getMethod(Class<?> targetClazz, String methodName, 
Class<?>... parameterTypes) {
+  public static Method getMethod(Class<?> targetClazz, String methodName, 
Class<?>... parameterTypes) throws TezReflectionException {
     try {
       return targetClazz.getMethod(methodName, parameterTypes);
     } catch (NoSuchMethodException e) {
-      throw new TezUncheckedException(e);
+      throw new TezReflectionException(e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-api/src/main/java/org/apache/tez/dag/api/TezReflectionException.java
----------------------------------------------------------------------
diff --git 
a/tez-api/src/main/java/org/apache/tez/dag/api/TezReflectionException.java 
b/tez-api/src/main/java/org/apache/tez/dag/api/TezReflectionException.java
new file mode 100644
index 0000000..4d8d1e0
--- /dev/null
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/TezReflectionException.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tez.dag.api;
+
+public class TezReflectionException extends TezException {
+
+  private static final long serialVersionUID = 7744789121243630729L;
+
+  public TezReflectionException(String message) {
+    super(message);
+  }
+
+  public TezReflectionException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+  public TezReflectionException(Throwable cause) {
+    super(cause);
+  }
+}

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-api/src/main/java/org/apache/tez/dag/api/client/TimelineReaderFactory.java
----------------------------------------------------------------------
diff --git 
a/tez-api/src/main/java/org/apache/tez/dag/api/client/TimelineReaderFactory.java
 
b/tez-api/src/main/java/org/apache/tez/dag/api/client/TimelineReaderFactory.java
index f544198..c0569dd 100644
--- 
a/tez-api/src/main/java/org/apache/tez/dag/api/client/TimelineReaderFactory.java
+++ 
b/tez-api/src/main/java/org/apache/tez/dag/api/client/TimelineReaderFactory.java
@@ -46,7 +46,6 @@ import 
org.apache.hadoop.security.authentication.client.ConnectionConfigurator;
 import org.apache.hadoop.security.ssl.SSLFactory;
 import org.apache.tez.common.ReflectionUtils;
 import org.apache.tez.dag.api.TezException;
-import org.apache.tez.dag.api.TezUncheckedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -167,7 +166,7 @@ public class TimelineReaderFactory {
       try {
         authenticator = getTokenAuthenticator();
         authenticator.setConnectionConfigurator(connectionConfigurator);
-      } catch (TezUncheckedException e) {
+      } catch (TezException e) {
         throw new IOException("Failed to get authenticator", e);
       }
 
@@ -179,13 +178,17 @@ public class TimelineReaderFactory {
         doAsUser = null;
       }
 
-      HttpURLConnectionFactory connectionFactory =
-          new TokenAuthenticatedURLConnectionFactory(connectionConfigurator, 
authenticator,
-              authUgi, doAsUser);
+      HttpURLConnectionFactory connectionFactory;
+      try {
+        connectionFactory = new 
TokenAuthenticatedURLConnectionFactory(connectionConfigurator, authenticator,
+            authUgi, doAsUser);
+      } catch (TezException e) {
+        throw new IOException("Fail to create 
TokenAuthenticatedURLConnectionFactory", e);
+      }
       return new Client(new URLConnectionClientHandler(connectionFactory), 
clientConfig);
     }
 
-    private static Authenticator getTokenAuthenticator() {
+    private static Authenticator getTokenAuthenticator() throws TezException {
       String authenticatorClazzName;
 
       if (UserGroupInformation.isSecurityEnabled()) {
@@ -208,7 +211,7 @@ public class TimelineReaderFactory {
       public TokenAuthenticatedURLConnectionFactory(ConnectionConfigurator 
connConfigurator,
                                                     Authenticator 
authenticator,
                                                     UserGroupInformation 
authUgi,
-                                                    String doAsUser) {
+                                                    String doAsUser) throws 
TezException {
         this.connConfigurator = connConfigurator;
         this.authenticator = authenticator;
         this.authUgi = authUgi;
@@ -377,7 +380,7 @@ public class TimelineReaderFactory {
 
         isTokenDelegationClassesPresent = true;
 
-      } catch (TezUncheckedException e) {
+      } catch (TezException e) {
         LOG.info("Could not find class required for token delegation, will 
fallback to pseudo auth");
       }
     }

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-api/src/test/java/org/apache/tez/common/TestReflectionUtils.java
----------------------------------------------------------------------
diff --git 
a/tez-api/src/test/java/org/apache/tez/common/TestReflectionUtils.java 
b/tez-api/src/test/java/org/apache/tez/common/TestReflectionUtils.java
index 253e3a7..2fbd35c 100644
--- a/tez-api/src/test/java/org/apache/tez/common/TestReflectionUtils.java
+++ b/tez-api/src/test/java/org/apache/tez/common/TestReflectionUtils.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.tez.dag.api.TezException;
+import org.apache.tez.dag.api.TezReflectionException;
 import org.junit.Test;
 
 public class TestReflectionUtils {
@@ -45,7 +46,7 @@ public class TestReflectionUtils {
   }
 
   @Test(timeout = 5000)
-  public void testConstructorWithParameters()
+  public void testConstructorWithParameters() throws TezReflectionException
   {
     Class<?>[] parameterTypes = new Class[] { String.class, Integer.TYPE };
     Object[] parameters = new Object[] { new String("test"), 1 };

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/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 6b4f4c9..e9f710e 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
@@ -54,7 +54,6 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.GnuParser;
 import org.apache.commons.cli.Options;

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-dag/src/main/java/org/apache/tez/dag/app/dag/RootInputInitializerManager.java
----------------------------------------------------------------------
diff --git 
a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/RootInputInitializerManager.java
 
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/RootInputInitializerManager.java
index 84379e6..63a46d6 100644
--- 
a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/RootInputInitializerManager.java
+++ 
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/RootInputInitializerManager.java
@@ -48,6 +48,7 @@ import org.apache.tez.common.ReflectionUtils;
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.InputInitializerDescriptor;
 import org.apache.tez.dag.api.RootInputLeafOutput;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.event.*;
 import org.apache.tez.dag.api.event.VertexState;
@@ -106,7 +107,7 @@ public class RootInputInitializerManager {
   }
   
   public void runInputInitializers(List<RootInputLeafOutput<InputDescriptor, 
InputInitializerDescriptor>> 
-      inputs) {
+      inputs) throws TezException {
     for (RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor> 
input : inputs) {
 
       InputInitializerContext context =
@@ -133,7 +134,7 @@ public class RootInputInitializerManager {
 
   @VisibleForTesting
   protected InputInitializer 
createInitializer(RootInputLeafOutput<InputDescriptor, 
InputInitializerDescriptor>
-      input, InputInitializerContext context) {
+      input, InputInitializerContext context) throws TezException {
     InputInitializer initializer = ReflectionUtils
         .createClazzInstance(input.getControllerDescriptor().getClassName(),
             new Class[]{InputInitializerContext.class}, new Object[]{context});

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java 
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
index c477b5d..38def6d 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
@@ -60,6 +60,7 @@ import org.apache.tez.dag.api.DagTypeConverters;
 import org.apache.tez.dag.api.EdgeProperty;
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.TezConfiguration;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.client.DAGStatus;
@@ -1321,7 +1322,16 @@ public class DAGImpl implements 
org.apache.tez.dag.app.dag.DAG,
       }
     }
 
-    createDAGEdges(this);
+    try {
+      createDAGEdges(this);
+    } catch (TezException e2) {
+      String msg = "Fail to create edges, " + ExceptionUtils.getStackTrace(e2);
+      addDiagnostic(msg);
+      LOG.error(msg);
+      trySetTerminationCause(DAGTerminationCause.INIT_FAILURE);
+      finished(DAGState.FAILED);
+      return DAGState.FAILED;
+    }
     Map<String,EdgePlan> edgePlans = 
DagTypeConverters.createEdgePlanMapFromDAGPlan(getJobPlan().getEdgeList());
 
     // setup the dag
@@ -1343,7 +1353,17 @@ public class DAGImpl implements 
org.apache.tez.dag.app.dag.DAG,
       }
     }
 
-    assignDAGScheduler(this);
+    try {
+      assignDAGScheduler(this);
+    } catch (TezException e1) {
+      String msg = "Fail to assign DAGScheduler for dag:" + dagName + " due to 
"
+          + ExceptionUtils.getStackTrace(e1);
+      LOG.error(msg);
+      addDiagnostic(msg);
+      trySetTerminationCause(DAGTerminationCause.INIT_FAILURE);
+      finished(DAGState.FAILED);
+      return DAGState.FAILED;
+    }
 
     for (Map.Entry<String, VertexGroupInfo> entry : vertexGroups.entrySet()) {
       String groupName = entry.getKey();
@@ -1364,7 +1384,7 @@ public class DAGImpl implements 
org.apache.tez.dag.app.dag.DAG,
     return DAGState.INITED;
   }
 
-  private void createDAGEdges(DAGImpl dag) {
+  private void createDAGEdges(DAGImpl dag) throws TezException {
     for (EdgePlan edgePlan : dag.getJobPlan().getEdgeList()) {
       EdgeProperty edgeProperty = DagTypeConverters
           .createEdgePropertyMapFromDAGPlan(edgePlan);
@@ -1375,7 +1395,7 @@ public class DAGImpl implements 
org.apache.tez.dag.app.dag.DAG,
     }
   }
 
-  private static void assignDAGScheduler(DAGImpl dag) {
+  private static void assignDAGScheduler(DAGImpl dag) throws TezException {
     String dagSchedulerClassName = 
dag.conf.get(TezConfiguration.TEZ_AM_DAG_SCHEDULER_CLASS,
         TezConfiguration.TEZ_AM_DAG_SCHEDULER_CLASS_DEFAULT);
     LOG.info("Using DAG Scheduler: " + dagSchedulerClassName);

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/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 1976649..089ebcd 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
@@ -31,6 +31,7 @@ import org.apache.tez.dag.api.EdgeManagerPlugin;
 import org.apache.tez.dag.api.EdgeManagerPluginContext;
 import org.apache.tez.dag.api.EdgeManagerPluginDescriptor;
 import org.apache.tez.dag.api.EdgeProperty;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.UserPayload;
 import org.apache.tez.dag.app.dag.Task;
@@ -106,13 +107,13 @@ public class Edge {
   private EventMetaData destinationMetaInfo;
 
   @SuppressWarnings("rawtypes")
-  public Edge(EdgeProperty edgeProperty, EventHandler eventHandler) {
+  public Edge(EdgeProperty edgeProperty, EventHandler eventHandler) throws 
TezException {
     this.edgeProperty = edgeProperty;
     this.eventHandler = eventHandler;
     createEdgeManager();
   }
 
-  private void createEdgeManager() {
+  private void createEdgeManager() throws TezException {
     switch (edgeProperty.getDataMovementType()) {
       case ONE_TO_ONE:
         edgeManagerContext = new EdgeManagerPluginContextImpl(null);
@@ -142,7 +143,7 @@ public class Edge {
       default:
         String message = "Unknown edge data movement type: "
             + edgeProperty.getDataMovementType();
-        throw new TezUncheckedException(message);
+        throw new TezException(message);
     }
   }
 
@@ -171,7 +172,11 @@ public class Edge {
             edgeProperty.getEdgeDestination());
     this.edgeProperty = modifiedEdgeProperty;
     boolean wasUnInitialized = (edgeManager == null);
-    createEdgeManager();
+    try {
+      createEdgeManager();
+    } catch (TezException e) {
+      throw new AMUserCodeException(Source.EdgeManager, e);
+    }
     initialize();
     if (wasUnInitialized) {
       sendEvent(new VertexEventNullEdgeInitialized(sourceVertex.getVertexId(), 
this, destinationVertex));

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
----------------------------------------------------------------------
diff --git 
a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java 
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
index 5a451e8..ca91bb9 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
@@ -71,6 +71,7 @@ import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.ProcessorDescriptor;
 import org.apache.tez.dag.api.RootInputLeafOutput;
 import org.apache.tez.dag.api.TezConfiguration;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.TaskLocationHint;
@@ -2102,7 +2103,13 @@ public class VertexImpl implements 
org.apache.tez.dag.app.dag.Vertex,
       }
     }
 
-    assignVertexManager();
+    try {
+      assignVertexManager();
+    } catch (TezException e1) {
+      String msg = "Fail to create VertexManager, " + 
ExceptionUtils.getStackTrace(e1);
+      LOG.error(msg);
+      return finished(VertexState.FAILED, VertexTerminationCause.INIT_FAILURE, 
msg);
+    }
 
     try {
       vertexManager.initialize();
@@ -2146,7 +2153,7 @@ public class VertexImpl implements 
org.apache.tez.dag.app.dag.Vertex,
     return VertexState.INITED;
   }
 
-  private void assignVertexManager() {
+  private void assignVertexManager() throws TezException {
     boolean hasBipartite = false;
     boolean hasOneToOne = false;
     boolean hasCustom = false;
@@ -2985,7 +2992,13 @@ public class VertexImpl implements 
org.apache.tez.dag.app.dag.Vertex,
 
         if (vertex.inputsWithInitializers != null) {
           LOG.info("Vertex will initialize from input initializer. " + 
vertex.logIdentifier);
-          vertex.setupInputInitializerManager();
+          try {
+            vertex.setupInputInitializerManager();
+          } catch (TezException e) {
+            String msg = "Fail to create InputInitializerManager, " + 
ExceptionUtils.getStackTrace(e);
+            LOG.info(msg);
+            return vertex.finished(VertexState.FAILED, 
VertexTerminationCause.INIT_FAILURE, msg);
+          }
           return VertexState.INITIALIZING;
         } else {
           boolean hasOneToOneUninitedSource = false;
@@ -3016,7 +3029,13 @@ public class VertexImpl implements 
org.apache.tez.dag.app.dag.Vertex,
         // this block may return VertexState.INITIALIZING
         if (vertex.inputsWithInitializers != null) {
           LOG.info("Vertex will initialize from input initializer. " + 
vertex.logIdentifier);
-          vertex.setupInputInitializerManager();
+          try {
+            vertex.setupInputInitializerManager();
+          } catch (TezException e) {
+            String msg = "Fail to create InputInitializerManager, " + 
ExceptionUtils.getStackTrace(e);
+            LOG.error(msg);
+            return vertex.finished(VertexState.FAILED, 
VertexTerminationCause.INIT_FAILURE, msg);
+          }
           return VertexState.INITIALIZING;
         }
         if (!vertex.uninitializedEdges.isEmpty()) {
@@ -3918,7 +3937,7 @@ public class VertexImpl implements 
org.apache.tez.dag.app.dag.Vertex,
     }
   }
 
-  private void setupInputInitializerManager() {
+  private void setupInputInitializerManager() throws TezException {
     rootInputInitializerManager = createRootInputInitializerManager(
         getDAG().getName(), getName(), getVertexId(),
         eventHandler, getTotalTasks(),

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/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 f02b73b..73011c6 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
@@ -41,6 +41,8 @@ import org.apache.tez.dag.api.EdgeProperty;
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.InputInitializerDescriptor;
 import org.apache.tez.dag.api.RootInputLeafOutput;
+import org.apache.tez.dag.api.TezException;
+import org.apache.tez.dag.api.TezReflectionException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.UserPayload;
 import org.apache.tez.dag.api.VertexLocationHint;
@@ -311,7 +313,7 @@ public class VertexManager {
   }
 
   public VertexManager(VertexManagerPluginDescriptor pluginDesc,
-      Vertex managedVertex, AppContext appContext, StateChangeNotifier 
stateChangeNotifier) {
+      Vertex managedVertex, AppContext appContext, StateChangeNotifier 
stateChangeNotifier) throws TezException {
     checkNotNull(pluginDesc, "pluginDesc is null");
     checkNotNull(managedVertex, "managedVertex is null");
     checkNotNull(appContext, "appContext is null");
@@ -331,8 +333,12 @@ public class VertexManager {
   public void initialize() throws AMUserCodeException {
     pluginContext = new VertexManagerPluginContextImpl();
     if (pluginDesc != null) {
-      plugin = ReflectionUtils.createClazzInstance(pluginDesc.getClassName(),
-          new Class[]{VertexManagerPluginContext.class}, new 
Object[]{pluginContext});
+      try {
+        plugin = ReflectionUtils.createClazzInstance(pluginDesc.getClassName(),
+            new Class[]{VertexManagerPluginContext.class}, new 
Object[]{pluginContext});
+      } catch (TezReflectionException e) {
+        throw new AMUserCodeException(Source.VertexManager, e);
+      }
       payload = pluginDesc.getUserPayload();
     }
     try {

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
----------------------------------------------------------------------
diff --git 
a/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
 
b/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
index 630c2b3..1ae88a0 100644
--- 
a/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
+++ 
b/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
@@ -341,7 +341,7 @@ public class TaskSchedulerEventHandler extends 
AbstractService
   }
   
   @Override
-  public synchronized void serviceStart() {
+  public synchronized void serviceStart() throws Exception {
     InetSocketAddress serviceAddr = clientService.getBindAddress();
     dagAppMaster = appContext.getAppMaster();
     // if web service is enabled then set tracking url. else disable it (value 
= "").

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/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 75e306c..751b7ef 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
@@ -721,6 +721,76 @@ public class TestDAGImpl {
     return dag;
   }
 
+  // v1 -> v2
+  private DAGPlan createDAGWithNonExistEdgeManager() {
+    LOG.info("Setting up dag plan with non-exist edgemanager");
+    DAGPlan dag = DAGPlan.newBuilder()
+        .setName("testverteximpl")
+        .addVertex(
+            VertexPlan.newBuilder()
+                .setName("vertex1")
+                .setType(PlanVertexType.NORMAL)
+                .addTaskLocationHint(
+                    PlanTaskLocationHint.newBuilder()
+                        .addHost("host1")
+                        .addRack("rack1")
+                        .build()
+                )
+                .setTaskConfig(
+                    PlanTaskConfiguration.newBuilder()
+                        .setNumTasks(1)
+                        .setVirtualCores(4)
+                        .setMemoryMb(1024)
+                        .setJavaOpts("")
+                        .setTaskModule("x1.y1")
+                        .build()
+                )
+                .addOutEdgeId("e1")
+                .build()
+        )
+          .addVertex(
+              VertexPlan.newBuilder()
+                  .setName("vertex2")
+                  .setType(PlanVertexType.NORMAL)
+                  .setProcessorDescriptor(
+                      
TezEntityDescriptorProto.newBuilder().setClassName("x2.y2"))
+                  .addTaskLocationHint(
+                      PlanTaskLocationHint.newBuilder()
+                          .addHost("host2")
+                          .addRack("rack2")
+                          .build()
+                  )
+                  .setTaskConfig(
+                      PlanTaskConfiguration.newBuilder()
+                          .setNumTasks(2)
+                          .setVirtualCores(4)
+                          .setMemoryMb(1024)
+                          .setJavaOpts("foo")
+                          .setTaskModule("x2.y2")
+                          .build()
+                  )
+                  .addInEdgeId("e1")
+                  .build()
+          )
+         .addEdge(
+             EdgePlan.newBuilder()
+                 .setEdgeManager(TezEntityDescriptorProto.newBuilder()
+                         .setClassName("non-exist-edge-manager")
+                 )
+                 
.setEdgeDestination(TezEntityDescriptorProto.newBuilder().setClassName("v1_v2"))
+                 .setInputVertexName("vertex1")
+                 
.setEdgeSource(TezEntityDescriptorProto.newBuilder().setClassName("o1"))
+                 .setOutputVertexName("vertex2")
+                 .setDataMovementType(PlanEdgeDataMovementType.CUSTOM)
+                 .setId("e1")
+                 .setDataSourceType(PlanEdgeDataSourceType.PERSISTED)
+                 .setSchedulingType(PlanEdgeSchedulingType.SEQUENTIAL)
+                 .build()
+         )
+          .build();
+    return dag;
+  }
+
   @BeforeClass
   public static void beforeClass() {
     MockDNSToSwitchMapping.initializeMockRackResolver();
@@ -905,6 +975,37 @@ public class TestDAGImpl {
     }
   }
 
+  @Test(timeout = 5000)
+  public void testNonExistEdgeManagerPlugin() {
+    dagPlan = createDAGWithNonExistEdgeManager();
+    dag = new DAGImpl(dagId, conf, dagPlan,
+        dispatcher.getEventHandler(),  taskAttemptListener,
+        fsTokens, clock, "user", thh, appContext);
+    doReturn(dag).when(appContext).getCurrentDAG();
+
+    dag.handle(new DAGEvent(dagId, DAGEventType.DAG_INIT));
+    Assert.assertEquals(DAGState.FAILED, dag.getState());
+    Assert.assertEquals(DAGTerminationCause.INIT_FAILURE, 
dag.getTerminationCause());
+    Assert.assertTrue(StringUtils.join(dag.getDiagnostics(), "")
+        .contains("java.lang.ClassNotFoundException: non-exist-edge-manager"));
+  }
+
+  @Test (timeout = 5000)
+  public void testNonExistDAGScheduler() {
+    conf.set(TezConfiguration.TEZ_AM_DAG_SCHEDULER_CLASS, 
"non-exist-dag-scheduler");
+    dag = new DAGImpl(dagId, conf, dagPlan,
+        dispatcher.getEventHandler(),  taskAttemptListener,
+        fsTokens, clock, "user", thh, appContext);
+    doReturn(dag).when(appContext).getCurrentDAG();
+
+    dag.handle(new DAGEvent(dag.getID(), DAGEventType.DAG_INIT));
+    Assert.assertEquals(DAGState.FAILED, dag.getState());
+    Assert.assertEquals(DAGState.FAILED, dag.getState());
+    Assert.assertEquals(DAGTerminationCause.INIT_FAILURE, 
dag.getTerminationCause());
+    Assert.assertTrue(StringUtils.join(dag.getDiagnostics(), "")
+        .contains("java.lang.ClassNotFoundException: 
non-exist-dag-scheduler"));
+  }
+
   @SuppressWarnings("unchecked")
   @Test(timeout = 5000)
   public void testVertexCompletion() {

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java
----------------------------------------------------------------------
diff --git 
a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java 
b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java
index 5718b17..20f6bf0 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java
@@ -53,6 +53,7 @@ import org.apache.tez.dag.api.EdgeProperty.DataSourceType;
 import org.apache.tez.dag.api.EdgeProperty.SchedulingType;
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.UserPayload;
 import org.apache.tez.dag.app.dag.Task;
 import org.apache.tez.dag.app.dag.Vertex;
@@ -127,7 +128,7 @@ public class TestEdge {
 
   @SuppressWarnings({ "rawtypes" })
   @Test (timeout = 5000)
-  public void testCompositeEventHandling() throws AMUserCodeException {
+  public void testCompositeEventHandling() throws AMUserCodeException, 
TezException {
     EventHandler eventHandler = mock(EventHandler.class);
     EdgeProperty edgeProp = 
EdgeProperty.create(DataMovementType.SCATTER_GATHER,
         DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL, 
mock(OutputDescriptor.class),

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/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 571b499..66a18b3 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
@@ -78,6 +78,7 @@ import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.ProcessorDescriptor;
 import org.apache.tez.dag.api.RootInputLeafOutput;
 import org.apache.tez.dag.api.TezConfiguration;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.UserPayload;
 import org.apache.tez.dag.api.VertexLocationHint;
@@ -549,6 +550,100 @@ public class TestVertexImpl {
     return dag;
   }
 
+  private DAGPlan createDAGPlanWithNonExistInputInitializer() {
+    LOG.info("Setting up dag plan with non exist inputinitializer");
+    DAGPlan dag = DAGPlan.newBuilder()
+        .setName("initializerWith0Tasks")
+        .addVertex(
+            VertexPlan.newBuilder()
+                .setName("vertex1")
+                .setType(PlanVertexType.NORMAL)
+                .addInputs(
+                    RootInputLeafOutputProto.newBuilder()
+                        .setControllerDescriptor(
+                            TezEntityDescriptorProto.newBuilder().setClassName(
+                                "non-exist-input-initializer"))
+                        .setName("input1")
+                        .setIODescriptor(
+                            TezEntityDescriptorProto.newBuilder()
+                                .setClassName("InputClazz")
+                                .build()
+                        )
+                        .build()
+                )
+                .setTaskConfig(
+                    PlanTaskConfiguration.newBuilder()
+                        .setNumTasks(1)
+                        .setVirtualCores(4)
+                        .setMemoryMb(1024)
+                        .setJavaOpts("")
+                        .setTaskModule("x1.y1")
+                        .build()
+                )
+                .build()
+        ).build();
+    return dag;
+  }
+
+  private DAGPlan createDAGPlanWithNonExistOutputCommitter() {
+    LOG.info("Setting up dag plan with non exist output committer");
+    DAGPlan dag = DAGPlan.newBuilder()
+        .setName("initializerWith0Tasks")
+        .addVertex(
+            VertexPlan.newBuilder()
+                .setName("vertex1")
+                .setType(PlanVertexType.NORMAL)
+                .addOutputs(
+                    RootInputLeafOutputProto.newBuilder()
+                        .setControllerDescriptor(
+                            TezEntityDescriptorProto.newBuilder().setClassName(
+                                "non-exist-output-committer"))
+                        .setName("output1")
+                        .setIODescriptor(
+                            TezEntityDescriptorProto.newBuilder()
+                                .setClassName("OutputClazz")
+                                .build()
+                        )
+                        .build()
+                )
+                .setTaskConfig(
+                    PlanTaskConfiguration.newBuilder()
+                        .setNumTasks(1)
+                        .setVirtualCores(4)
+                        .setMemoryMb(1024)
+                        .setJavaOpts("")
+                        .setTaskModule("x1.y1")
+                        .build()
+                )
+                .build()
+        ).build();
+    return dag;
+  }
+
+  private DAGPlan createDAGPlanWithNonExistVertexManager() {
+    LOG.info("Setting up dag plan with non-exist VertexManager");
+    DAGPlan dag = DAGPlan.newBuilder()
+        .setName("initializerWith0Tasks")
+        .addVertex(
+            VertexPlan.newBuilder()
+                .setName("vertex1")
+                .setType(PlanVertexType.NORMAL)
+                .setTaskConfig(
+                    PlanTaskConfiguration.newBuilder()
+                        .setNumTasks(1)
+                        .setVirtualCores(4)
+                        .setMemoryMb(1024)
+                        .setJavaOpts("")
+                        .setTaskModule("x1.y1")
+                        .build()
+                )
+                .setVertexManagerPlugin(TezEntityDescriptorProto.newBuilder()
+                    .setClassName("non-exist-vertexmanager"))
+                .build()
+        ).build();
+     return dag;
+  }
+
   private DAGPlan createDAGPlanWithMixedEdges() {
     LOG.info("Setting up mixed edge dag plan");
     org.apache.tez.dag.api.DAG dag = 
org.apache.tez.dag.api.DAG.create("MixedEdges");
@@ -2187,7 +2282,11 @@ public class TestVertexImpl {
     for (EdgePlan edgePlan : dagPlan.getEdgeList()) {
       EdgeProperty edgeProperty = DagTypeConverters
           .createEdgePropertyMapFromDAGPlan(edgePlan);
-      edges.put(edgePlan.getId(), new Edge(edgeProperty, 
dispatcher.getEventHandler()));
+      try {
+        edges.put(edgePlan.getId(), new Edge(edgeProperty, 
dispatcher.getEventHandler()));
+      } catch (TezException e) {
+        throw new AMUserCodeException(Source.EdgeManager, e);
+      }
     }
 
     parseVertexEdges();
@@ -2214,7 +2313,7 @@ public class TestVertexImpl {
   }
 
   @Before
-  public void setup() throws AMUserCodeException {
+  public void setup() throws TezException, AMUserCodeException {
     useCustomInitializer = false;
     customInitializer = null;
     setupPreDagCreation();
@@ -2335,6 +2434,45 @@ public class TestVertexImpl {
         .getOutputDescriptor().getClassName()));
   }
 
+  @Test(timeout=5000)
+  public void testNonExistVertexManager() throws TezException, 
AMUserCodeException {
+    setupPreDagCreation();
+    dagPlan = createDAGPlanWithNonExistVertexManager();
+    setupPostDagCreation();
+    VertexImpl v1 = vertices.get("vertex1");
+    v1.handle(new VertexEvent(v1.getVertexId(), VertexEventType.V_INIT));
+    Assert.assertEquals(VertexState.FAILED, v1.getState());
+    Assert.assertEquals(VertexTerminationCause.AM_USERCODE_FAILURE, 
v1.getTerminationCause());
+    Assert.assertTrue(StringUtils.join(v1.getDiagnostics(),"")
+        .contains("java.lang.ClassNotFoundException: 
non-exist-vertexmanager"));
+  }
+
+  @Test(timeout=5000)
+  public void testNonExistInputInitializer() throws TezException, 
AMUserCodeException {
+    setupPreDagCreation();
+    dagPlan = createDAGPlanWithNonExistInputInitializer();
+    setupPostDagCreation();
+    VertexImpl v1 = vertices.get("vertex1");
+    v1.handle(new VertexEvent(v1.getVertexId(), VertexEventType.V_INIT));
+    Assert.assertEquals(VertexState.FAILED, v1.getState());
+    Assert.assertEquals(VertexTerminationCause.INIT_FAILURE, 
v1.getTerminationCause());
+    Assert.assertTrue(StringUtils.join(v1.getDiagnostics(),"")
+        .contains("java.lang.ClassNotFoundException: 
non-exist-input-initializer"));
+  }
+
+  @Test(timeout=5000)
+  public void testNonExistOutputCommitter() throws TezException, 
AMUserCodeException {
+    setupPreDagCreation();
+    dagPlan = createDAGPlanWithNonExistOutputCommitter();
+    setupPostDagCreation();
+    VertexImpl v1 = vertices.get("vertex1");
+    v1.handle(new VertexEvent(v1.getVertexId(), VertexEventType.V_INIT));
+    Assert.assertEquals(VertexState.FAILED, v1.getState());
+    Assert.assertEquals(VertexTerminationCause.INIT_FAILURE, 
v1.getTerminationCause());
+    Assert.assertTrue(StringUtils.join(v1.getDiagnostics(),"")
+        .contains("java.lang.ClassNotFoundException: 
non-exist-output-committer"));
+  }
+
   class TestUpdateListener implements VertexStateUpdateListener {
     List<VertexStateUpdate> events = Lists.newLinkedList();
     @Override
@@ -3526,7 +3664,7 @@ public class TestVertexImpl {
 
   @SuppressWarnings("unchecked")
   @Test(timeout = 5000)
-  public void testVertexWithInitializerFailure() throws AMUserCodeException {
+  public void testVertexWithInitializerFailure() throws AMUserCodeException, 
TezException {
     useCustomInitializer = true;
     setupPreDagCreation();
     dagPlan = createDAGPlanWithInputInitializer("TestInputInitializer");
@@ -4831,7 +4969,7 @@ public class TestVertexImpl {
       hasShutDown = true;
     }
 
-    public void failInputInitialization() {
+    public void failInputInitialization() throws TezException {
       super.runInputInitializers(inputs);
       eventHandler.handle(new VertexEventRootInputFailed(vertexID, inputs
           .get(0).getName(),

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
----------------------------------------------------------------------
diff --git 
a/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
 
b/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
index 4f4dfe7..5194e54 100644
--- 
a/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
+++ 
b/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.tez.common.ReflectionUtils;
 import org.apache.tez.common.counters.TezCounters;
 import org.apache.tez.dag.api.EdgeManagerPluginDescriptor;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.UserPayload;
 import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.TaskLocationHint;
@@ -77,7 +78,7 @@ public class TestHistoryEventsProtoConversion {
       TestHistoryEventsProtoConversion.class);
 
 
-  private HistoryEvent testProtoConversion(HistoryEvent event) throws 
IOException {
+  private HistoryEvent testProtoConversion(HistoryEvent event) throws 
IOException, TezException {
     ByteArrayOutputStream os = new ByteArrayOutputStream();
     HistoryEvent deserializedEvent = null;
     event.toProtoStream(os);
@@ -94,7 +95,7 @@ public class TestHistoryEventsProtoConversion {
   }
 
   private HistoryEvent testSummaryProtoConversion(HistoryEvent historyEvent)
-      throws IOException {
+      throws IOException, TezException {
     SummaryEvent event = (SummaryEvent) historyEvent;
     ByteArrayOutputStream os = new ByteArrayOutputStream();
     HistoryEvent deserializedEvent = null;
@@ -728,7 +729,7 @@ public class TestHistoryEventsProtoConversion {
       }
     }
 
-  private void testDAGRecoveredEvent() {
+  private void testDAGRecoveredEvent() throws TezException {
     DAGRecoveredEvent dagRecoveredEvent = new DAGRecoveredEvent(
         ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1),
         TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1),

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-dag/src/test/java/org/apache/tez/runtime/task/TestTaskExecution.java
----------------------------------------------------------------------
diff --git 
a/tez-dag/src/test/java/org/apache/tez/runtime/task/TestTaskExecution.java 
b/tez-dag/src/test/java/org/apache/tez/runtime/task/TestTaskExecution.java
index 57c3251..4708bef 100644
--- a/tez-dag/src/test/java/org/apache/tez/runtime/task/TestTaskExecution.java
+++ b/tez-dag/src/test/java/org/apache/tez/runtime/task/TestTaskExecution.java
@@ -238,7 +238,7 @@ public class TestTaskExecution {
         assertTrue(cause instanceof TezException);
       }
       assertNull(taskReporter.currentCallable);
-      umbilical.verifyTaskFailedEvent("Failure while running 
task:org.apache.tez.dag.api.TezUncheckedException: "
+      umbilical.verifyTaskFailedEvent("Failure while running 
task:org.apache.tez.dag.api.TezReflectionException: "
             + "Unable to load class: NotExitedProcessor");
     } finally {
       executor.shutdownNow();

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplit.java
----------------------------------------------------------------------
diff --git 
a/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplit.java
 
b/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplit.java
index 0c1c327..4f3a0f2 100644
--- 
a/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplit.java
+++ 
b/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplit.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.InputSplit;
 import org.apache.hadoop.util.ReflectionUtils;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 
 /**
@@ -106,10 +107,14 @@ public class TezGroupedSplit implements InputSplit, 
Configurable {
   public void readFields(DataInput in) throws IOException {
     wrappedInputFormatName = Text.readString(in);
     String inputSplitClassName = Text.readString(in);
-    Class<? extends InputSplit> clazz = 
-        (Class<? extends InputSplit>) 
-        TezGroupedSplitsInputFormat.getClassFromName(inputSplitClassName);
-    
+    Class<? extends InputSplit> clazz = null;
+    try {
+      clazz = (Class<? extends InputSplit>)
+      TezGroupedSplitsInputFormat.getClassFromName(inputSplitClassName);
+    } catch (TezException e) {
+      throw new IOException(e);
+    }
+
     int numSplits = in.readInt();
     
     wrappedSplits = new ArrayList<InputSplit>(numSplits);

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplitsInputFormat.java
----------------------------------------------------------------------
diff --git 
a/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplitsInputFormat.java
 
b/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplitsInputFormat.java
index a1044f0..1c9052a 100644
--- 
a/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplitsInputFormat.java
+++ 
b/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/split/TezGroupedSplitsInputFormat.java
@@ -32,7 +32,7 @@ import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.RecordReader;
 import org.apache.hadoop.mapred.Reporter;
 import org.apache.tez.common.ReflectionUtils;
-import org.apache.tez.dag.api.TezUncheckedException;
+import org.apache.tez.dag.api.TezException;
 
 import com.google.common.base.Preconditions;
 
@@ -82,24 +82,28 @@ public class TezGroupedSplitsInputFormat<K, V>
   public RecordReader<K, V> getRecordReader(InputSplit split, JobConf job,
       Reporter reporter) throws IOException {
     TezGroupedSplit groupedSplit = (TezGroupedSplit) split;
-    initInputFormatFromSplit(groupedSplit);
+    try {
+      initInputFormatFromSplit(groupedSplit);
+    } catch (TezException e) {
+      throw new IOException(e);
+    }
     return new TezGroupedSplitsRecordReader(groupedSplit, job, reporter);
   }
   
   @SuppressWarnings({ "unchecked", "rawtypes" })
-  void initInputFormatFromSplit(TezGroupedSplit split) {
+  void initInputFormatFromSplit(TezGroupedSplit split) throws TezException {
     if (wrappedInputFormat == null) {
       Class<? extends InputFormat> clazz = (Class<? extends InputFormat>) 
           getClassFromName(split.wrappedInputFormatName);
       try {
         wrappedInputFormat = 
org.apache.hadoop.util.ReflectionUtils.newInstance(clazz, conf);
       } catch (Exception e) {
-        throw new TezUncheckedException(e);
+        throw new TezException(e);
       }
     }
   }
 
-  static Class<?> getClassFromName(String name) {
+  static Class<?> getClassFromName(String name) throws TezException {
     return ReflectionUtils.getClazz(name);
   }
 

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplit.java
----------------------------------------------------------------------
diff --git 
a/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplit.java
 
b/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplit.java
index 9275f14..f85bbcd 100644
--- 
a/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplit.java
+++ 
b/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplit.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.mapreduce.InputSplit;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 
 /**
@@ -108,9 +109,13 @@ public class TezGroupedSplit extends InputSplit
   public void readFields(DataInput in) throws IOException {
     wrappedInputFormatName = Text.readString(in);
     String inputSplitClassName = Text.readString(in);
-    Class<? extends InputSplit> clazz = 
-        (Class<? extends InputSplit>) 
-        TezGroupedSplitsInputFormat.getClassFromName(inputSplitClassName);
+    Class<? extends InputSplit> clazz = null;
+    try {
+      clazz = (Class<? extends InputSplit>)
+      TezGroupedSplitsInputFormat.getClassFromName(inputSplitClassName);
+    } catch (TezException e) {
+      throw new IOException(e);
+    }
     
     int numSplits = in.readInt();
     

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplitsInputFormat.java
----------------------------------------------------------------------
diff --git 
a/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplitsInputFormat.java
 
b/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplitsInputFormat.java
index 58fcf73..beca152 100644
--- 
a/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplitsInputFormat.java
+++ 
b/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/TezGroupedSplitsInputFormat.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.mapreduce.JobContext;
 import org.apache.hadoop.mapreduce.RecordReader;
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.tez.common.ReflectionUtils;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 
 import com.google.common.base.Preconditions;
@@ -117,24 +118,28 @@ public class TezGroupedSplitsInputFormat<K, V> extends 
InputFormat<K, V>
   public RecordReader<K, V> createRecordReader(InputSplit split,
       TaskAttemptContext context) throws IOException, InterruptedException {
     TezGroupedSplit groupedSplit = (TezGroupedSplit) split;
-    initInputFormatFromSplit(groupedSplit);
+    try {
+      initInputFormatFromSplit(groupedSplit);
+    } catch (TezException e) {
+      throw new IOException(e);
+    }
     return new TezGroupedSplitsRecordReader(groupedSplit, context);
   }
   
   @SuppressWarnings({ "rawtypes", "unchecked" })
-  void initInputFormatFromSplit(TezGroupedSplit split) {
+  void initInputFormatFromSplit(TezGroupedSplit split) throws TezException {
     if (wrappedInputFormat == null) {
       Class<? extends InputFormat> clazz = (Class<? extends InputFormat>) 
           getClassFromName(split.wrappedInputFormatName);
       try {
         wrappedInputFormat = 
org.apache.hadoop.util.ReflectionUtils.newInstance(clazz, conf);
       } catch (Exception e) {
-        throw new TezUncheckedException(e);
+        throw new TezException(e);
       }
     }
   }
   
-  static Class<?> getClassFromName(String name) {
+  static Class<?> getClassFromName(String name) throws TezException {
     return ReflectionUtils.getClazz(name);
   }
   

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-plugins/tez-yarn-timeline-history/src/main/java/org/apache/tez/dag/history/logging/ats/ATSHistoryLoggingService.java
----------------------------------------------------------------------
diff --git 
a/tez-plugins/tez-yarn-timeline-history/src/main/java/org/apache/tez/dag/history/logging/ats/ATSHistoryLoggingService.java
 
b/tez-plugins/tez-yarn-timeline-history/src/main/java/org/apache/tez/dag/history/logging/ats/ATSHistoryLoggingService.java
index a237718..9856d8c 100644
--- 
a/tez-plugins/tez-yarn-timeline-history/src/main/java/org/apache/tez/dag/history/logging/ats/ATSHistoryLoggingService.java
+++ 
b/tez-plugins/tez-yarn-timeline-history/src/main/java/org/apache/tez/dag/history/logging/ats/ATSHistoryLoggingService.java
@@ -40,6 +40,7 @@ import org.apache.tez.common.security.HistoryACLPolicyManager;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.TezConstants;
+import org.apache.tez.dag.api.TezReflectionException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.history.DAGHistoryEvent;
 import org.apache.tez.dag.history.HistoryEventType;
@@ -128,7 +129,7 @@ public class ATSHistoryLoggingService extends 
HistoryLoggingService {
       historyACLPolicyManager = ReflectionUtils.createClazzInstance(
           atsHistoryACLManagerClassName);
       historyACLPolicyManager.setConf(conf);
-    } catch (TezUncheckedException e) {
+    } catch (TezReflectionException e) {
       LOG.warn("Could not instantiate object for " + 
atsHistoryACLManagerClassName
           + ". ACLs cannot be enforced correctly for history data in 
Timeline", e);
       if 
(!conf.getBoolean(TezConfiguration.TEZ_AM_ALLOW_DISABLED_TIMELINE_DOMAINS,

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
----------------------------------------------------------------------
diff --git 
a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
 
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
index 603603e..5cd832b 100644
--- 
a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
+++ 
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/LogicalIOProcessorRuntimeTask.java
@@ -49,6 +49,7 @@ import org.apache.tez.common.ReflectionUtils;
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.ProcessorDescriptor;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.records.TezTaskAttemptID;
 import org.apache.tez.runtime.api.AbstractLogicalIOProcessor;
@@ -462,7 +463,7 @@ public class LogicalIOProcessorRuntimeTask extends 
RuntimeTask {
     return false;
   }
 
-  private void initializeGroupInputs() {
+  private void initializeGroupInputs() throws TezException {
     if (groupInputSpecs != null && !groupInputSpecs.isEmpty()) {
      groupInputsMap = new ConcurrentHashMap<String, 
MergedLogicalInput>(groupInputSpecs.size());
      for (GroupInputSpec groupInputSpec : groupInputSpecs) {
@@ -533,7 +534,7 @@ public class LogicalIOProcessorRuntimeTask extends 
RuntimeTask {
     return processorContext;
   }
 
-  private LogicalInput createInput(InputSpec inputSpec, InputContext 
inputContext) {
+  private LogicalInput createInput(InputSpec inputSpec, InputContext 
inputContext) throws TezException {
     LOG.info("Creating Input");
     InputDescriptor inputDesc = inputSpec.getInputDescriptor();
     Input input = ReflectionUtils.createClazzInstance(inputDesc.getClassName(),
@@ -549,7 +550,7 @@ public class LogicalIOProcessorRuntimeTask extends 
RuntimeTask {
 
   private LogicalInput createMergedInput(InputDescriptor inputDesc,
                                          MergedInputContext mergedInputContext,
-                                         List<Input> constituentInputs) {
+                                         List<Input> constituentInputs) throws 
TezException {
     LogicalInput input = 
ReflectionUtils.createClazzInstance(inputDesc.getClassName(),
         new Class[]{MergedInputContext.class, List.class},
         new Object[]{mergedInputContext, constituentInputs});
@@ -561,7 +562,7 @@ public class LogicalIOProcessorRuntimeTask extends 
RuntimeTask {
     return input;
   }
 
-  private LogicalOutput createOutput(OutputSpec outputSpec, OutputContext 
outputContext) {
+  private LogicalOutput createOutput(OutputSpec outputSpec, OutputContext 
outputContext) throws TezException {
     LOG.info("Creating Output");
     OutputDescriptor outputDesc = outputSpec.getOutputDescriptor();
     Output output = 
ReflectionUtils.createClazzInstance(outputDesc.getClassName(),
@@ -577,7 +578,7 @@ public class LogicalIOProcessorRuntimeTask extends 
RuntimeTask {
   }
 
   private AbstractLogicalIOProcessor createProcessor(
-      String processorClassName, ProcessorContext processorContext) {
+      String processorClassName, ProcessorContext processorContext) throws 
TezException {
     Processor processor = 
ReflectionUtils.createClazzInstance(processorClassName,
         new Class[]{ProcessorContext.class}, new Object[]{processorContext});
     if (!(processor instanceof AbstractLogicalIOProcessor)) {

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-runtime-internals/src/main/java/org/apache/tez/runtime/common/resources/MemoryDistributor.java
----------------------------------------------------------------------
diff --git 
a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/common/resources/MemoryDistributor.java
 
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/common/resources/MemoryDistributor.java
index 00c381c..a38d7aa 100644
--- 
a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/common/resources/MemoryDistributor.java
+++ 
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/common/resources/MemoryDistributor.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.tez.common.ReflectionUtils;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.EntityDescriptor;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.runtime.api.MemoryUpdateCallback;
 import org.apache.tez.runtime.api.InputContext;
@@ -100,8 +101,9 @@ public class MemoryDistributor {
   /**
    * Used by the Tez framework to distribute initial memory after components
    * have made their initial requests.
+   * @throws TezException
    */
-  public void makeInitialAllocations() {
+  public void makeInitialAllocations() throws TezException {
     Preconditions.checkState(numInputsSeen.get() == numTotalInputs, "All 
inputs are expected to ask for memory");
     Preconditions.checkState(numOutputsSeen.get() == numTotalOutputs, "All 
outputs are expected to ask for memory");
     Iterable<InitialMemoryRequestContext> requestContexts = 
Iterables.transform(requestList,

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-runtime-internals/src/test/java/org/apache/tez/runtime/common/resources/TestMemoryDistributor.java
----------------------------------------------------------------------
diff --git 
a/tez-runtime-internals/src/test/java/org/apache/tez/runtime/common/resources/TestMemoryDistributor.java
 
b/tez-runtime-internals/src/test/java/org/apache/tez/runtime/common/resources/TestMemoryDistributor.java
index 951a877..7fbd87f 100644
--- 
a/tez-runtime-internals/src/test/java/org/apache/tez/runtime/common/resources/TestMemoryDistributor.java
+++ 
b/tez-runtime-internals/src/test/java/org/apache/tez/runtime/common/resources/TestMemoryDistributor.java
@@ -28,6 +28,7 @@ import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.ProcessorDescriptor;
 import org.apache.tez.dag.api.TezConfiguration;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.runtime.api.MemoryUpdateCallback;
 import org.apache.tez.runtime.api.InputContext;
 import org.apache.tez.runtime.api.OutputContext;
@@ -47,7 +48,7 @@ public class TestMemoryDistributor {
   }
   
   @Test(timeout = 5000)
-  public void testScalingNoProcessor() {
+  public void testScalingNoProcessor() throws TezException {
     MemoryDistributor dist = new MemoryDistributor(2, 1, conf);
     
     dist.setJvmMemory(10000l);
@@ -81,7 +82,7 @@ public class TestMemoryDistributor {
   }
   
   @Test(timeout = 5000)
-  public void testScalingNoProcessor2() {
+  public void testScalingNoProcessor2() throws TezException {
     // Real world values
     MemoryDistributor dist = new MemoryDistributor(2, 0, conf);
     
@@ -106,7 +107,7 @@ public class TestMemoryDistributor {
   }
   
   @Test(timeout = 5000)
-  public void testScalingProcessor() {
+  public void testScalingProcessor() throws TezException {
     MemoryDistributor dist = new MemoryDistributor(2, 1, conf);
     
     dist.setJvmMemory(10000l);
@@ -148,7 +149,7 @@ public class TestMemoryDistributor {
   }
   
   @Test(timeout = 5000)
-  public void testScalingDisabled() {
+  public void testScalingDisabled() throws TezException {
     // Real world values
     Configuration conf = new Configuration(this.conf);
     conf.setBoolean(TezConfiguration.TEZ_TASK_SCALE_MEMORY_ENABLED, false);
@@ -175,7 +176,7 @@ public class TestMemoryDistributor {
   }
   
   @Test(timeout = 5000)
-  public void testReserveFractionConfigured() {
+  public void testReserveFractionConfigured() throws TezException {
     Configuration conf = new Configuration(this.conf);
     conf.setDouble(TezConfiguration.TEZ_TASK_SCALE_MEMORY_RESERVE_FRACTION, 
0.5d);
     MemoryDistributor dist = new MemoryDistributor(2, 1, conf);

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-runtime-library/src/test/java/org/apache/tez/runtime/common/resources/TestWeightedScalingMemoryDistributor.java
----------------------------------------------------------------------
diff --git 
a/tez-runtime-library/src/test/java/org/apache/tez/runtime/common/resources/TestWeightedScalingMemoryDistributor.java
 
b/tez-runtime-library/src/test/java/org/apache/tez/runtime/common/resources/TestWeightedScalingMemoryDistributor.java
index 04d3594..eafbf03 100644
--- 
a/tez-runtime-library/src/test/java/org/apache/tez/runtime/common/resources/TestWeightedScalingMemoryDistributor.java
+++ 
b/tez-runtime-library/src/test/java/org/apache/tez/runtime/common/resources/TestWeightedScalingMemoryDistributor.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.TezConfiguration;
+import org.apache.tez.dag.api.TezException;
 import org.apache.tez.runtime.api.LogicalInput;
 import org.apache.tez.runtime.api.LogicalOutput;
 import org.apache.tez.runtime.api.MemoryUpdateCallback;
@@ -51,7 +52,7 @@ public class TestWeightedScalingMemoryDistributor extends 
TestMemoryDistributor
   }
   
   @Test(timeout = 5000)
-  public void testSimpleWeightedScaling() {
+  public void testSimpleWeightedScaling() throws TezException {
     Configuration conf = new Configuration(this.conf);
     conf.setStrings(TezConfiguration.TEZ_TASK_SCALE_MEMORY_WEIGHTED_RATIOS,
         WeightedScalingMemoryDistributor.generateWeightStrings(0, 1, 2, 3, 1, 
1));
@@ -98,7 +99,7 @@ public class TestWeightedScalingMemoryDistributor extends 
TestMemoryDistributor
   }
 
   @Test(timeout = 5000)
-  public void testAdditionalReserveFractionWeightedScaling() {
+  public void testAdditionalReserveFractionWeightedScaling() throws 
TezException {
     Configuration conf = new Configuration(this.conf);
     conf.setStrings(TezConfiguration.TEZ_TASK_SCALE_MEMORY_WEIGHTED_RATIOS,
         WeightedScalingMemoryDistributor.generateWeightStrings(0, 2, 3, 6, 1, 
1));

http://git-wip-us.apache.org/repos/asf/tez/blob/bc56e10f/tez-tests/src/test/java/org/apache/tez/mapreduce/TestMRRJobsDAGApi.java
----------------------------------------------------------------------
diff --git 
a/tez-tests/src/test/java/org/apache/tez/mapreduce/TestMRRJobsDAGApi.java 
b/tez-tests/src/test/java/org/apache/tez/mapreduce/TestMRRJobsDAGApi.java
index c32d311..0e90fae 100644
--- a/tez-tests/src/test/java/org/apache/tez/mapreduce/TestMRRJobsDAGApi.java
+++ b/tez-tests/src/test/java/org/apache/tez/mapreduce/TestMRRJobsDAGApi.java
@@ -90,6 +90,7 @@ import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.ProcessorDescriptor;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.TezException;
+import org.apache.tez.dag.api.TezReflectionException;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.UserPayload;
 import org.apache.tez.dag.api.Vertex;
@@ -887,7 +888,7 @@ public class TestMRRJobsDAGApi {
         LOG.info("Class found");
         FileSystem fs = FileSystem.get(conf);
         fs.mkdirs(new Path("/tmp/relocalizationfilefound"));
-      } catch (TezUncheckedException e) {
+      } catch (TezReflectionException e) {
         LOG.info("Class not found");
       }
 

Reply via email to