diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index 959e76e8b86..f6c95e8e94a 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -398,6 +398,9 @@ Release 2.0.5-beta - UNRELEASED
MAPREDUCE-4942. mapreduce.Job has a bunch of methods that throw
InterruptedException so its incompatible with MR1. (rkanter via tucu)
+ MAPREDUCE-5239. Updated MR App to reflect YarnRemoteException changes after
+ YARN-634. (Siddharth Seth via vinodkv)
+
Release 2.0.4-alpha - 2013-04-25
INCOMPATIBLE CHANGES
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncher.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncher.java
index 681d4daef27..597b52dd42a 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncher.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncher.java
@@ -66,7 +66,6 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.factory.providers.YarnRemoteExceptionFactoryProvider;
import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.util.BuilderUtils;
@@ -407,8 +406,7 @@ public class TestContainerLauncher {
throws YarnRemoteException {
Exception e = new Exception("Dummy function", new Exception(
"Dummy function cause"));
- throw YarnRemoteExceptionFactoryProvider.getYarnRemoteExceptionFactory(
- null).createYarnRemoteException(e);
+ throw new YarnRemoteException(e);
}
}
}
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java
index ad35651b2dc..57f803de5e6 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java
@@ -443,11 +443,6 @@ public class TestContainerLauncherImpl {
super(message);
}
- @Override
- public String getRemoteTrace() {
- return null;
- }
-
@Override
public YarnRemoteException getCause() {
return null;
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java
index 503d188c97a..9de044109f2 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java
@@ -101,7 +101,6 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.factory.providers.YarnRemoteExceptionFactoryProvider;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.service.AbstractService;
import org.junit.Test;
@@ -298,8 +297,7 @@ public class TestClientRedirect {
@Override
public SubmitApplicationResponse submitApplication(
SubmitApplicationRequest request) throws YarnRemoteException {
- throw YarnRemoteExceptionFactoryProvider.getYarnRemoteExceptionFactory(
- null).createYarnRemoteException("Test");
+ throw new YarnRemoteException("Test");
}
@Override
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index fa3a15810aa..86a908ef5dd 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -240,6 +240,9 @@ Release 2.0.5-beta - UNRELEASED
YARN-598. Add virtual cores to queue metrics. (sandyr via tucu)
+ YARN-634. Modified YarnRemoteException to be not backed by PB and introduced
+ a separate SerializedException record. (Siddharth Seth via vinodkv)
+
OPTIMIZATIONS
BUG FIXES
diff --git a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml
index 4ba2d72289e..fd7da24b030 100644
--- a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml
+++ b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml
@@ -277,4 +277,10 @@
+
+
+
+
+
+
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/YarnRemoteException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/YarnRemoteException.java
index 7b4c02524c3..d03f8dd6b46 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/YarnRemoteException.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/YarnRemoteException.java
@@ -18,43 +18,24 @@
package org.apache.hadoop.yarn.exceptions;
-import java.io.PrintStream;
-import java.io.PrintWriter;
+public class YarnRemoteException extends Exception {
-public abstract class YarnRemoteException extends Exception {
private static final long serialVersionUID = 1L;
-
+
public YarnRemoteException() {
super();
}
-
- public YarnRemoteException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public YarnRemoteException(Throwable cause) {
- super(cause);
- }
-
+
public YarnRemoteException(String message) {
super(message);
}
-
- @Override
- public void printStackTrace(PrintWriter pw) {
- pw.append("RemoteTrace: \n").append(getRemoteTrace())
- .append(" at LocalTrace: \n\t");
- super.printStackTrace(pw);
+
+ public YarnRemoteException(Throwable cause) {
+ super(cause);
}
- @Override
- public void printStackTrace(PrintStream ps) {
- ps.append("RemoteTrace: \n").append(getRemoteTrace())
- .append(" at Local Trace: \n\t");
- super.printStackTrace(ps);
+ public YarnRemoteException(String message, Throwable cause) {
+ super(message, cause);
}
-
- public abstract String getRemoteTrace();
-
- public abstract YarnRemoteException getCause();
+
}
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/package-info.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/package-info.java
deleted file mode 100644
index 5277764e50b..00000000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-@InterfaceAudience.Private
-package org.apache.hadoop.yarn.exceptions.impl.pb;
-import org.apache.hadoop.classification.InterfaceAudience;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
index 212f0ec82d0..23afa1159c1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
@@ -23,11 +23,11 @@ option java_generate_equals_and_hash = true;
import "Security.proto";
-message YarnRemoteExceptionProto {
+message SerializedExceptionProto {
optional string message = 1;
optional string trace = 2;
optional string class_name = 3;
- optional YarnRemoteExceptionProto cause = 4;
+ optional SerializedExceptionProto cause = 4;
}
message ApplicationIdProto {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
index c5732013fdd..66956b3e0b9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
@@ -107,27 +107,6 @@
-
- compile-protoc
- generate-sources
-
- protoc
-
-
-
- ${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto
- ${basedir}/../hadoop-yarn-api/src/main/proto
- ${basedir}/src/main/proto
-
-
-
-
-
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/YarnRemoteExceptionFactoryPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/YarnRemoteExceptionFactoryPBImpl.java
deleted file mode 100644
index 857c0017f9d..00000000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/YarnRemoteExceptionFactoryPBImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
-* 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.hadoop.yarn.factories.impl.pb;
-
-import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
-import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
-import org.apache.hadoop.yarn.factories.YarnRemoteExceptionFactory;
-
-public class YarnRemoteExceptionFactoryPBImpl implements
- YarnRemoteExceptionFactory {
-
- private static final YarnRemoteExceptionFactory self = new YarnRemoteExceptionFactoryPBImpl();
-
- private YarnRemoteExceptionFactoryPBImpl() {
- }
-
- public static YarnRemoteExceptionFactory get() {
- return self;
- }
-
- @Override
- public YarnRemoteException createYarnRemoteException(String message) {
- return new YarnRemoteExceptionPBImpl(message);
- }
-
- @Override
- public YarnRemoteException createYarnRemoteException(String message,
- Throwable t) {
- return new YarnRemoteExceptionPBImpl(message, t);
- }
-
- @Override
- public YarnRemoteException createYarnRemoteException(Throwable t) {
- return new YarnRemoteExceptionPBImpl(t);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java
deleted file mode 100644
index e6e3b4353cb..00000000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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.hadoop.yarn.factory.providers;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.yarn.YarnException;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.factories.YarnRemoteExceptionFactory;
-import org.apache.hadoop.yarn.factories.impl.pb.YarnRemoteExceptionFactoryPBImpl;
-
-public class YarnRemoteExceptionFactoryProvider {
-
- private YarnRemoteExceptionFactoryProvider() {
- }
-
- public static YarnRemoteExceptionFactory getYarnRemoteExceptionFactory(Configuration conf) {
- if (conf == null) {
- conf = new Configuration();
- }
- String recordFactoryClassName = conf.get(YarnConfiguration.IPC_EXCEPTION_FACTORY);
- if (recordFactoryClassName == null) {
- String serializer = conf.get(YarnConfiguration.IPC_SERIALIZER_TYPE, YarnConfiguration.DEFAULT_IPC_SERIALIZER_TYPE);
- if (serializer.equals(YarnConfiguration.DEFAULT_IPC_SERIALIZER_TYPE)) {
- return YarnRemoteExceptionFactoryPBImpl.get();
- } else {
- throw new YarnException("Unknown serializer: [" + conf.get(YarnConfiguration.IPC_SERIALIZER_TYPE) + "]. Use keys: [" + YarnConfiguration.IPC_EXCEPTION_FACTORY + "] to specify Exception factory");
- }
- } else {
- return (YarnRemoteExceptionFactory) getFactoryClassInstance(recordFactoryClassName);
- }
- }
-
- private static Object getFactoryClassInstance(String factoryClassName) {
- try {
- Class> clazz = Class.forName(factoryClassName);
- Method method = clazz.getMethod("get", null);
- method.setAccessible(true);
- return method.invoke(null, null);
- } catch (ClassNotFoundException e) {
- throw new YarnException(e);
- } catch (NoSuchMethodException e) {
- throw new YarnException(e);
- } catch (InvocationTargetException e) {
- throw new YarnException(e);
- } catch (IllegalAccessException e) {
- throw new YarnException(e);
- }
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java
index 3926c3081de..7c190e9c5da 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java
@@ -22,45 +22,27 @@ import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.UndeclaredThrowableException;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
-import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
-import org.apache.hadoop.yarn.factories.YarnRemoteExceptionFactory;
-import org.apache.hadoop.yarn.factory.providers.YarnRemoteExceptionFactoryProvider;
import com.google.protobuf.ServiceException;
public class RPCUtil {
-
/**
- * Relying on the default factory configuration to be set correctly
- * for the default configuration.
- */
- private static Configuration conf = new Configuration();
- private static YarnRemoteExceptionFactory exceptionFactory = YarnRemoteExceptionFactoryProvider.getYarnRemoteExceptionFactory(conf);
-
- /**
- * Returns the YarnRemoteException which is serializable.
+ * Returns an instance of YarnRemoteException
*/
public static YarnRemoteException getRemoteException(Throwable t) {
- return exceptionFactory.createYarnRemoteException(t);
+ return new YarnRemoteException(t);
}
/**
- * Returns the YarnRemoteException which is serializable.
+ * Returns an instance of YarnRemoteException
*/
public static YarnRemoteException getRemoteException(String message) {
- return exceptionFactory.createYarnRemoteException(message);
+ return new YarnRemoteException(message);
}
- public static String toString(YarnRemoteException e) {
- return (e.getMessage() == null ? "" : e.getMessage()) +
- (e.getRemoteTrace() == null ? "" : "\n StackTrace: " + e.getRemoteTrace()) +
- (e.getCause() == null ? "" : "\n Caused by: " + toString(e.getCause()));
- }
-
/**
* Utility method that unwraps and throws appropriate exception.
*
@@ -85,8 +67,8 @@ public class RPCUtil {
ex.initCause(re);
return ex;
} else {
- throw ((RemoteException) se.getCause())
- .unwrapRemoteException(YarnRemoteExceptionPBImpl.class);
+ // TODO Fix in YARN-628.
+ throw new IOException((RemoteException) se.getCause());
}
} catch (IOException e1) {
throw new UndeclaredThrowableException(e1);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java
index 7454955bbc0..2c03c350742 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java
@@ -48,7 +48,6 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.factory.providers.YarnRemoteExceptionFactoryProvider;
import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.util.BuilderUtils;
@@ -165,8 +164,7 @@ public class TestContainerLaunchRPC {
throws YarnRemoteException {
Exception e = new Exception("Dummy function", new Exception(
"Dummy function cause"));
- throw YarnRemoteExceptionFactoryProvider.getYarnRemoteExceptionFactory(
- null).createYarnRemoteException(e);
+ throw new YarnRemoteException(e);
}
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java
index 92bbb8dc4bf..5485927dcae 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java
@@ -49,9 +49,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.factory.providers.YarnRemoteExceptionFactoryProvider;
import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
-import org.apache.hadoop.yarn.ipc.RPCUtil;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.util.BuilderUtils;
import org.apache.hadoop.yarn.util.Records;
@@ -154,7 +152,7 @@ public class TestRPC {
exception = true;
Assert.assertTrue(e.getMessage().contains(EXCEPTION_MSG));
Assert.assertTrue(e.getMessage().contains(EXCEPTION_CAUSE));
- System.out.println("Test Exception is " + RPCUtil.toString(e));
+ System.out.println("Test Exception is " + e.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
}
@@ -196,8 +194,7 @@ public class TestRPC {
throws YarnRemoteException {
Exception e = new Exception(EXCEPTION_MSG,
new Exception(EXCEPTION_CAUSE));
- throw YarnRemoteExceptionFactoryProvider
- .getYarnRemoteExceptionFactory(null).createYarnRemoteException(e);
+ throw new YarnRemoteException(e);
}
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/proto/yarnprototunnelrpc.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/SerializedException.java
similarity index 59%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/proto/yarnprototunnelrpc.proto
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/SerializedException.java
index f6a7723204d..9750607d212 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/proto/yarnprototunnelrpc.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/SerializedException.java
@@ -16,20 +16,24 @@
* limitations under the License.
*/
-option java_package = "org.apache.hadoop.yarn.ipc";
-option java_outer_classname = "RpcProtos";
-option java_generate_equals_and_hash = true;
+package org.apache.hadoop.yarn.server.api.records;
-import "yarn_protos.proto";
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
-message ProtoSpecificRpcRequest {
- required string method_name = 1;
- optional bytes request_proto = 2;
-}
-
-message ProtoSpecificRpcResponse {
- optional bytes response_proto = 1;
-
- optional bool is_error = 2;
- optional YarnRemoteExceptionProto exception = 3;
-}
+@Private
+@Unstable
+public abstract class SerializedException {
+
+ public abstract void init(String message, Throwable cause);
+
+ public abstract void init(String message);
+
+ public abstract void init(Throwable cause);
+
+ public abstract String getMessage();
+
+ public abstract String getRemoteTrace();
+
+ public abstract SerializedException getCause();
+}
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/YarnRemoteExceptionPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/SerializedExceptionPBImpl.java
similarity index 53%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/YarnRemoteExceptionPBImpl.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/SerializedExceptionPBImpl.java
index 7a00010dcd8..428cfe41ebd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/YarnRemoteExceptionPBImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/SerializedExceptionPBImpl.java
@@ -16,49 +16,49 @@
* limitations under the License.
*/
-package org.apache.hadoop.yarn.exceptions.impl.pb;
+package org.apache.hadoop.yarn.server.api.records.impl.pb;
-import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.lang.reflect.UndeclaredThrowableException;
-import org.apache.hadoop.ipc.RemoteException;
-import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
-import org.apache.hadoop.yarn.proto.YarnProtos.YarnRemoteExceptionProto;
-import org.apache.hadoop.yarn.proto.YarnProtos.YarnRemoteExceptionProtoOrBuilder;
-import com.google.protobuf.ServiceException;
+import org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProtoOrBuilder;
+import org.apache.hadoop.yarn.server.api.records.SerializedException;
-public class YarnRemoteExceptionPBImpl extends YarnRemoteException {
+public class SerializedExceptionPBImpl extends SerializedException {
- private static final long serialVersionUID = 1L;
-
- YarnRemoteExceptionProto proto = YarnRemoteExceptionProto.getDefaultInstance();
- YarnRemoteExceptionProto.Builder builder = null;
+ SerializedExceptionProto proto = SerializedExceptionProto
+ .getDefaultInstance();
+ SerializedExceptionProto.Builder builder = null;
boolean viaProto = false;
- public YarnRemoteExceptionPBImpl() {
+ public SerializedExceptionPBImpl() {
}
- public YarnRemoteExceptionPBImpl(YarnRemoteExceptionProto proto) {
+ public SerializedExceptionPBImpl(SerializedExceptionProto proto) {
this.proto = proto;
viaProto = true;
}
-
- public YarnRemoteExceptionPBImpl(String message) {
- super(message);
- maybeInitBuilder();
- builder.setMessage(super.getMessage());
+
+ private SerializedExceptionPBImpl(Throwable t) {
+ init(t);
}
- public YarnRemoteExceptionPBImpl(Throwable t) {
- super(t);
+ public void init(String message) {
maybeInitBuilder();
+ builder.setMessage(message);
+ }
- if (t.getCause() == null) {
+ public void init(Throwable t) {
+ maybeInitBuilder();
+ if (t == null) {
+ return;
+ }
+
+ if (t.getCause() == null) {
} else {
- builder.setCause(new YarnRemoteExceptionPBImpl(t.getCause()).getProto());
- builder.setClassName(t.getClass().getName());
+ builder.setCause(new SerializedExceptionPBImpl(t.getCause()).getProto());
+ builder.setClassName(t.getClass().getCanonicalName());
}
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@@ -69,35 +69,36 @@ public class YarnRemoteExceptionPBImpl extends YarnRemoteException {
if (t.getMessage() != null)
builder.setMessage(t.getMessage());
}
-
- public YarnRemoteExceptionPBImpl(String message, Throwable t) {
- this(t);
- if (message != null)
+
+ public void init(String message, Throwable t) {
+ init(t);
+ if (message != null)
builder.setMessage(message);
}
+
@Override
public String getMessage() {
- YarnRemoteExceptionProtoOrBuilder p = viaProto ? proto : builder;
+ SerializedExceptionProtoOrBuilder p = viaProto ? proto : builder;
return p.getMessage();
}
-
+
@Override
public String getRemoteTrace() {
- YarnRemoteExceptionProtoOrBuilder p = viaProto ? proto : builder;
+ SerializedExceptionProtoOrBuilder p = viaProto ? proto : builder;
return p.getTrace();
}
@Override
- public YarnRemoteException getCause() {
- YarnRemoteExceptionProtoOrBuilder p = viaProto ? proto : builder;
+ public SerializedException getCause() {
+ SerializedExceptionProtoOrBuilder p = viaProto ? proto : builder;
if (p.hasCause()) {
- return new YarnRemoteExceptionPBImpl(p.getCause());
+ return new SerializedExceptionPBImpl(p.getCause());
} else {
return null;
}
}
- public YarnRemoteExceptionProto getProto() {
+ public SerializedExceptionProto getProto() {
proto = viaProto ? proto : builder.build();
viaProto = true;
return proto;
@@ -105,9 +106,8 @@ public class YarnRemoteExceptionPBImpl extends YarnRemoteException {
private void maybeInitBuilder() {
if (viaProto || builder == null) {
- builder = YarnRemoteExceptionProto.newBuilder(proto);
+ builder = SerializedExceptionProto.newBuilder(proto);
}
viaProto = false;
}
-
}
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/YarnServerBuilderUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/YarnServerBuilderUtils.java
index 12020c7d2bd..c31a77b3b37 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/YarnServerBuilderUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/YarnServerBuilderUtils.java
@@ -27,6 +27,8 @@ import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse;
import org.apache.hadoop.yarn.server.api.records.MasterKey;
import org.apache.hadoop.yarn.server.api.records.NodeAction;
+import org.apache.hadoop.yarn.server.api.records.SerializedException;
+import org.apache.hadoop.yarn.util.Records;
/**
* Server Builder utilities to construct various objects.
@@ -55,4 +57,10 @@ public class YarnServerBuilderUtils {
}
return response;
}
+
+ public static SerializedException newSerializedException(Throwable e) {
+ SerializedException se = Records.newRecord(SerializedException.class);
+ se.init(e);
+ return se;
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/LocalResourceStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/LocalResourceStatus.java
index 91870b41b05..70a96cd60f8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/LocalResourceStatus.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/LocalResourceStatus.java
@@ -19,18 +19,18 @@ package org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.api.records.URL;
-import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
+import org.apache.hadoop.yarn.server.api.records.SerializedException;
public interface LocalResourceStatus {
public LocalResource getResource();
public ResourceStatusType getStatus();
public URL getLocalPath();
public long getLocalSize();
- public YarnRemoteException getException();
+ public SerializedException getException();
public void setResource(LocalResource resource);
public void setStatus(ResourceStatusType status);
public void setLocalPath(URL localPath);
public void setLocalSize(long size);
- public void setException(YarnRemoteException exception);
+ public void setException(SerializedException exception);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/LocalResourceStatusPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/LocalResourceStatusPBImpl.java
index 57f96081b8f..56858be72b5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/LocalResourceStatusPBImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/LocalResourceStatusPBImpl.java
@@ -22,14 +22,14 @@ import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.api.records.URL;
import org.apache.hadoop.yarn.api.records.impl.pb.LocalResourcePBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.URLPBImpl;
-import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
-import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProto;
import org.apache.hadoop.yarn.proto.YarnProtos.URLProto;
-import org.apache.hadoop.yarn.proto.YarnProtos.YarnRemoteExceptionProto;
import org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProto;
import org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProtoOrBuilder;
import org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.ResourceStatusTypeProto;
+import org.apache.hadoop.yarn.server.api.records.SerializedException;
+import org.apache.hadoop.yarn.server.api.records.impl.pb.SerializedExceptionPBImpl;
import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus;
import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.ResourceStatusType;
@@ -43,7 +43,7 @@ public class LocalResourceStatusPBImpl
private LocalResource resource;
private URL localPath;
- private YarnRemoteException exception;
+ private SerializedException exception;
public LocalResourceStatusPBImpl() {
builder = LocalResourceStatusProto.newBuilder();
@@ -73,7 +73,7 @@ public class LocalResourceStatusPBImpl
builder.setLocalPath(convertToProtoFormat(this.localPath));
}
if (this.exception != null &&
- !((YarnRemoteExceptionPBImpl)this.exception).getProto()
+ !((SerializedExceptionPBImpl)this.exception).getProto()
.equals(builder.getException())) {
builder.setException(convertToProtoFormat(this.exception));
}
@@ -136,7 +136,7 @@ public class LocalResourceStatusPBImpl
}
@Override
- public YarnRemoteException getException() {
+ public SerializedException getException() {
LocalResourceStatusProtoOrBuilder p = viaProto ? proto : builder;
if (this.exception != null) {
return this.exception;
@@ -182,7 +182,7 @@ public class LocalResourceStatusPBImpl
}
@Override
- public void setException(YarnRemoteException exception) {
+ public void setException(SerializedException exception) {
maybeInitBuilder();
if (exception == null)
builder.clearException();
@@ -213,12 +213,12 @@ public class LocalResourceStatusPBImpl
return ResourceStatusType.valueOf(e.name());
}
- private YarnRemoteExceptionPBImpl convertFromProtoFormat(YarnRemoteExceptionProto p) {
- return new YarnRemoteExceptionPBImpl(p);
+ private SerializedExceptionPBImpl convertFromProtoFormat(SerializedExceptionProto p) {
+ return new SerializedExceptionPBImpl(p);
}
- private YarnRemoteExceptionProto convertToProtoFormat(YarnRemoteException t) {
- return ((YarnRemoteExceptionPBImpl)t).getProto();
+ private SerializedExceptionProto convertToProtoFormat(SerializedException t) {
+ return ((SerializedExceptionPBImpl)t).getProto();
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java
index 119576342a4..3344e8bbcec 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java
@@ -35,7 +35,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.api.ContainerExitStatus;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
@@ -45,8 +44,6 @@ import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.EventHandler;
-import org.apache.hadoop.yarn.factories.RecordFactory;
-import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.server.nodemanager.NMAuditLogger;
import org.apache.hadoop.yarn.server.nodemanager.NMAuditLogger.AuditConstants;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.AuxServicesEvent;
@@ -85,7 +82,6 @@ public class ContainerImpl implements Container {
private final Configuration daemonConf;
private static final Log LOG = LogFactory.getLog(Container.class);
- private final RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
private final Map> pendingResources =
new HashMap>();
private final Map> localizedResources =
@@ -703,9 +699,9 @@ public class ContainerImpl implements Container {
ContainerResourceFailedEvent rsrcFailedEvent =
(ContainerResourceFailedEvent) event;
- container.diagnostics.append(
- StringUtils.stringifyException(rsrcFailedEvent.getCause())).append(
- "\n");
+ container.diagnostics.append(rsrcFailedEvent.getDiagnosticMessage()
+ + "\n");
+
// Inform the localizer to decrement reference counts and cleanup
// resources.
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerResourceFailedEvent.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerResourceFailedEvent.java
index b9c6372f74e..073141906d8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerResourceFailedEvent.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerResourceFailedEvent.java
@@ -23,15 +23,15 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.Loca
public class ContainerResourceFailedEvent extends ContainerResourceEvent {
- private final Throwable exception;
+ private final String diagnosticMesage;
public ContainerResourceFailedEvent(ContainerId container,
- LocalResourceRequest rsrc, Throwable cause) {
+ LocalResourceRequest rsrc, String diagnosticMesage) {
super(container, ContainerEventType.RESOURCE_FAILED, rsrc);
- this.exception = cause;
+ this.diagnosticMesage = diagnosticMesage;
}
- public Throwable getCause() {
- return exception;
+ public String getDiagnosticMessage() {
+ return diagnosticMesage;
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java
index 0e5e398c45d..8dce003bb69 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java
@@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletionService;
@@ -57,7 +56,6 @@ import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.ipc.RPCUtil;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol;
import org.apache.hadoop.yarn.server.nodemanager.api.ResourceLocalizationSpec;
@@ -67,6 +65,7 @@ import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerSt
import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.ResourceStatusType;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.security.LocalizerTokenIdentifier;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.security.LocalizerTokenSecretManager;
+import org.apache.hadoop.yarn.server.utils.YarnServerBuilderUtils;
import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.hadoop.yarn.util.FSDownload;
@@ -295,10 +294,11 @@ public class ContainerLocalizer {
stat.setStatus(ResourceStatusType.FETCH_SUCCESS);
} catch (ExecutionException e) {
stat.setStatus(ResourceStatusType.FETCH_FAILURE);
- stat.setException(RPCUtil.getRemoteException(e.getCause()));
+ stat.setException(
+ YarnServerBuilderUtils.newSerializedException(e.getCause()));
} catch (CancellationException e) {
stat.setStatus(ResourceStatusType.FETCH_FAILURE);
- stat.setException(RPCUtil.getRemoteException(e));
+ stat.setException(YarnServerBuilderUtils.newSerializedException(e));
}
// TODO shouldn't remove until ACK
i.remove();
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalizedResource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalizedResource.java
index 22304fcd695..7c22d9fa9f9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalizedResource.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalizedResource.java
@@ -17,7 +17,6 @@
*/
package org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer;
-import java.util.EnumSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.Semaphore;
@@ -42,7 +41,6 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.even
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceReleaseEvent;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceRequestEvent;
import org.apache.hadoop.yarn.state.InvalidStateTransitonException;
-import org.apache.hadoop.yarn.state.MultipleArcTransition;
import org.apache.hadoop.yarn.state.SingleArcTransition;
import org.apache.hadoop.yarn.state.StateMachine;
import org.apache.hadoop.yarn.state.StateMachineFactory;
@@ -251,11 +249,10 @@ public class LocalizedResource implements EventHandler {
ResourceFailedLocalizationEvent failedEvent =
(ResourceFailedLocalizationEvent) event;
Queue containers = rsrc.ref;
- Throwable failureCause = failedEvent.getCause();
for (ContainerId container : containers) {
rsrc.dispatcher.getEventHandler().handle(
new ContainerResourceFailedEvent(container, failedEvent
- .getLocalResourceRequest(), failureCause));
+ .getLocalResourceRequest(), failedEvent.getDiagnosticMessage()));
}
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
index f9a6778b37b..abd8044610e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
@@ -716,8 +716,8 @@ public class ResourceLocalizationService extends CompositeService
LOG.info("Failed to download rsrc " + assoc.getResource(),
e.getCause());
LocalResourceRequest req = assoc.getResource().getRequest();
- publicRsrc.handle(new ResourceFailedLocalizationEvent(req, e
- .getCause()));
+ publicRsrc.handle(new ResourceFailedLocalizationEvent(req,
+ e.getMessage()));
assoc.getResource().unlock();
} catch (CancellationException e) {
// ignore; shutting down
@@ -908,11 +908,12 @@ public class ResourceLocalizationService extends CompositeService
response.setLocalizerAction(LocalizerAction.LIVE);
break;
case FETCH_FAILURE:
- LOG.info("DEBUG: FAILED " + req, stat.getException());
+ LOG.info("DEBUG: FAILED " + req
+ + ", " + stat.getException().getMessage());
response.setLocalizerAction(LocalizerAction.DIE);
getLocalResourcesTracker(req.getVisibility(), user, applicationId)
- .handle(
- new ResourceFailedLocalizationEvent(req, stat.getException()));
+ .handle(new ResourceFailedLocalizationEvent(
+ req, stat.getException().getMessage()));
// unlocking the resource and removing it from scheduled resource
// list
@@ -924,8 +925,8 @@ public class ResourceLocalizationService extends CompositeService
LOG.info("Unknown status: " + stat.getStatus());
response.setLocalizerAction(LocalizerAction.DIE);
getLocalResourcesTracker(req.getVisibility(), user, applicationId)
- .handle(
- new ResourceFailedLocalizationEvent(req, stat.getException()));
+ .handle(new ResourceFailedLocalizationEvent(
+ req, stat.getException().getMessage()));
break;
}
}
@@ -991,7 +992,7 @@ public class ResourceLocalizationService extends CompositeService
// 3.1) notify resource of failed localization
ContainerId cId = context.getContainerId();
dispatcher.getEventHandler().handle(
- new ContainerResourceFailedEvent(cId, null, e));
+ new ContainerResourceFailedEvent(cId, null, e.getMessage()));
} finally {
for (LocalizerResourceRequestEvent event : scheduled.values()) {
event.getResource().unlock();
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/event/ResourceFailedLocalizationEvent.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/event/ResourceFailedLocalizationEvent.java
index 79b28bac908..7a9764f496c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/event/ResourceFailedLocalizationEvent.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/event/ResourceFailedLocalizationEvent.java
@@ -25,15 +25,15 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.Loca
*/
public class ResourceFailedLocalizationEvent extends ResourceEvent {
- private Throwable cause;
+ private final String diagnosticMesage;
public ResourceFailedLocalizationEvent(LocalResourceRequest rsrc,
- Throwable cause) {
+ String diagnosticMesage) {
super(rsrc, ResourceEventType.LOCALIZATION_FAILED);
- this.cause = cause;
+ this.diagnosticMesage = diagnosticMesage;
}
- public Throwable getCause() {
- return cause;
+ public String getDiagnosticMessage() {
+ return diagnosticMesage;
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/proto/yarn_server_nodemanager_service_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/proto/yarn_server_nodemanager_service_protos.proto
index b1d6ddc5925..166ea5b3702 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/proto/yarn_server_nodemanager_service_protos.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/proto/yarn_server_nodemanager_service_protos.proto
@@ -34,7 +34,7 @@ message LocalResourceStatusProto {
optional ResourceStatusTypeProto status = 2;
optional URLProto localPath = 3;
optional int64 localSize = 4;
- optional YarnRemoteExceptionProto exception = 5;
+ optional SerializedExceptionProto exception = 5;
}
message LocalizerStatusProto {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
index 39f1f017620..283134c312e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
@@ -299,7 +299,7 @@ public class TestNodeManagerResync {
" yet connected with ResourceManager"));
// TO DO: This should be replaced to explicitly check exception
// class name after YARN-142
- Assert.assertTrue(e.getRemoteTrace().contains(
+ Assert.assertTrue(e.getMessage().contains(
NMNotYetReadyException.class.getName()));
} catch (IOException e) {
assertionFailedInThread.set(true);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java
index 71c7f9f62d4..be6d7e2e38e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java
@@ -34,7 +34,6 @@ import org.apache.hadoop.yarn.api.records.impl.pb.LocalResourcePBImpl;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.ipc.RPCUtil;
import org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProto;
import org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalizerHeartbeatResponseProto;
import org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalizerStatusProto;
@@ -44,6 +43,7 @@ import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerAc
import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerHeartbeatResponse;
import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus;
import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.ResourceStatusType;
+import org.apache.hadoop.yarn.server.utils.YarnServerBuilderUtils;
import org.apache.hadoop.yarn.util.ConverterUtils;
import org.junit.Test;
@@ -82,7 +82,7 @@ public class TestPBRecordImpl {
e.setStackTrace(new StackTraceElement[] {
new StackTraceElement("foo", "bar", "baz", 10),
new StackTraceElement("sbb", "one", "onm", 10) });
- ret.setException(RPCUtil.getRemoteException(e));
+ ret.setException(YarnServerBuilderUtils.newSerializedException(e));
return ret;
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java
index f2fd09e6109..f488f70e7e9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java
@@ -576,7 +576,7 @@ public class TestContainerManager extends BaseContainerManagerTest {
"Container " + cId1 + " rejected as it is allocated by a previous RM"));
// TO DO: This should be replaced to explicitly check exception
// class name after YARN-142
- Assert.assertTrue(e.getRemoteTrace().contains(
+ Assert.assertTrue(e.getMessage().contains(
InvalidContainerException.class.getName()));
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java
index c98379cb26c..9c5918dc7c9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java
@@ -25,11 +25,9 @@ import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -56,10 +54,10 @@ import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.DrainDispatcher;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor.ExitCode;
-import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEvent;
-import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.AuxServicesEvent;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.AuxServicesEventType;
+import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEvent;
+import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainersLauncherEvent;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainersLauncherEventType;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalResourceRequest;
@@ -663,7 +661,7 @@ public class TestContainer {
LocalResourceRequest req = new LocalResourceRequest(rsrc);
Exception e = new Exception("Fake localization error");
c.handle(new ContainerResourceFailedEvent(c.getContainer()
- .getId(), req, e));
+ .getId(), req, e.getMessage()));
drainDispatcherEvents();
}
@@ -679,7 +677,7 @@ public class TestContainer {
LocalResourceRequest req = new LocalResourceRequest(rsrc.getValue());
Exception e = new Exception("Fake localization error");
c.handle(new ContainerResourceFailedEvent(c.getContainer().getId(),
- req, e));
+ req, e.getMessage()));
}
drainDispatcherEvents();
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/MockLocalResourceStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/MockLocalResourceStatus.java
index cb2a621715a..882068a7339 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/MockLocalResourceStatus.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/MockLocalResourceStatus.java
@@ -19,7 +19,7 @@ package org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.api.records.URL;
-import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
+import org.apache.hadoop.yarn.server.api.records.SerializedException;
import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus;
import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.ResourceStatusType;
@@ -29,11 +29,11 @@ public class MockLocalResourceStatus implements LocalResourceStatus {
private ResourceStatusType tag = null;
private URL localPath = null;
private long size = -1L;
- private YarnRemoteException ex = null;
+ private SerializedException ex = null;
MockLocalResourceStatus() { }
MockLocalResourceStatus(LocalResource rsrc, ResourceStatusType tag,
- URL localPath, YarnRemoteException ex) {
+ URL localPath, SerializedException ex) {
this.rsrc = rsrc;
this.tag = tag;
this.localPath = localPath;
@@ -49,7 +49,7 @@ public class MockLocalResourceStatus implements LocalResourceStatus {
@Override
public URL getLocalPath() { return localPath; }
@Override
- public YarnRemoteException getException() { return ex; }
+ public SerializedException getException() { return ex; }
@Override
public void setResource(LocalResource rsrc) { this.rsrc = rsrc; }
@Override
@@ -59,7 +59,7 @@ public class MockLocalResourceStatus implements LocalResourceStatus {
@Override
public void setLocalSize(long size) { this.size = size; }
@Override
- public void setException(YarnRemoteException ex) { this.ex = ex; }
+ public void setException(SerializedException ex) { this.ex = ex; }
@Override
public boolean equals(Object o) {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalResourcesTrackerImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalResourcesTrackerImpl.java
index 91c6c5e6abc..e0459a43b5b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalResourcesTrackerImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalResourcesTrackerImpl.java
@@ -287,8 +287,8 @@ public class TestLocalResourcesTrackerImpl {
Assert.assertTrue(localrsrc.get(lr).ref.contains(cId2));
// Failing resource localization
- ResourceEvent resourceFailedEvent =
- new ResourceFailedLocalizationEvent(lr, new Exception("test"));
+ ResourceEvent resourceFailedEvent = new ResourceFailedLocalizationEvent(
+ lr,(new Exception("test").getMessage()));
// Backing up the resource to track its state change as it will be
// removed after the failed event.
@@ -420,7 +420,8 @@ public class TestLocalResourcesTrackerImpl {
Path hierarchicalPath2 = tracker.getPathForLocalization(lr2, localDir);
// localization failed.
ResourceFailedLocalizationEvent rfe2 =
- new ResourceFailedLocalizationEvent(lr2, new Exception("Test"));
+ new ResourceFailedLocalizationEvent(
+ lr2, new Exception("Test").toString());
tracker.handle(rfe2);
/*
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java
index 90c80637648..cd12ea58d6f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java
@@ -85,7 +85,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.AsyncDispatcher;
import org.apache.hadoop.yarn.event.DrainDispatcher;
import org.apache.hadoop.yarn.event.EventHandler;
-import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
+import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService;
@@ -117,6 +117,7 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.even
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.LocalizerEventType;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.LocalizerResourceRequestEvent;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceFailedLocalizationEvent;
+import org.apache.hadoop.yarn.server.utils.YarnServerBuilderUtils;
import org.apache.hadoop.yarn.util.BuilderUtils;
import org.apache.hadoop.yarn.util.ConverterUtils;
import org.junit.BeforeClass;
@@ -1012,7 +1013,8 @@ public class TestResourceLocalizationService {
String localizerId, LocalResourceRequest req) {
LocalizerStatus status = createLocalizerStatus(localizerId);
LocalResourceStatus resourceStatus = new LocalResourceStatusPBImpl();
- resourceStatus.setException(new YarnRemoteExceptionPBImpl("test"));
+ resourceStatus.setException(YarnServerBuilderUtils
+ .newSerializedException(new YarnRemoteException("test")));
resourceStatus.setStatus(ResourceStatusType.FETCH_FAILURE);
resourceStatus.setResource(req);
status.addResourceStatus(resourceStatus);
@@ -1146,7 +1148,8 @@ public class TestResourceLocalizationService {
// Now Failing the resource download. As a part of it
// resource state is changed and then lock is released.
ResourceFailedLocalizationEvent locFailedEvent =
- new ResourceFailedLocalizationEvent(req, new Exception("test"));
+ new ResourceFailedLocalizationEvent(
+ req,new Exception("test").toString());
spyService.getLocalResourcesTracker(LocalResourceVisibility.PUBLIC, user,
null).handle(locFailedEvent);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java
index 73ccc0348c6..6d446611a6a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java
@@ -467,9 +467,11 @@ public class TestAppManager{
" request is invalid.");
} catch (YarnRemoteException e) {
// Exception is expected
+ // TODO Change this to assert the expected exception type - post YARN-142
+ // sub-task related to specialized exceptions.
Assert.assertTrue("The thrown exception is not" +
" InvalidResourceRequestException",
- e.getMessage().startsWith("Invalid resource request"));
+ e.getMessage().contains("Invalid resource request"));
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
index d25f0f93d5e..577ea0a6682 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
@@ -209,10 +209,10 @@ public class TestClientRMService {
checkTokenRenewal(owner, other);
return null;
} catch (YarnRemoteException ex) {
- Assert.assertEquals(ex.getMessage(),
+ Assert.assertTrue(ex.getMessage().contains(
"Client " + owner.getUserName() +
" tries to renew a token with renewer specified as " +
- other.getUserName());
+ other.getUserName()));
throw ex;
}
}