diff --git hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncher.java hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncher.java index 681d4da..597b52d 100644 --- hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncher.java +++ 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.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 StopContainerResponse stopContainer(StopContainerRequest request) 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 hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java index ad35651..57f803d 100644 --- hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java +++ hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java @@ -444,11 +444,6 @@ public ContainerException(String message) { } @Override - public String getRemoteTrace() { - return null; - } - - @Override public YarnRemoteException getCause() { return null; } diff --git hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java index 503d188..9de0441 100644 --- hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java +++ 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.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 GetApplicationReportResponse getApplicationReport( @Override public SubmitApplicationResponse submitApplication( SubmitApplicationRequest request) throws YarnRemoteException { - throw YarnRemoteExceptionFactoryProvider.getYarnRemoteExceptionFactory( - null).createYarnRemoteException("Test"); + throw new YarnRemoteException("Test"); } @Override diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java index e69de29..65a02d0 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java @@ -0,0 +1,34 @@ +/** + * 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.api.records; + +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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SerializedExceptionPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SerializedExceptionPBImpl.java index e69de29..5f1eb3d 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SerializedExceptionPBImpl.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SerializedExceptionPBImpl.java @@ -0,0 +1,113 @@ +/** + * 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.api.records.impl.pb; + +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.apache.hadoop.yarn.api.records.SerializedException; +import org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProto; +import org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProtoOrBuilder; + +public class SerializedExceptionPBImpl extends SerializedException { + + SerializedExceptionProto proto = SerializedExceptionProto + .getDefaultInstance(); + SerializedExceptionProto.Builder builder = null; + boolean viaProto = false; + + public SerializedExceptionPBImpl() { + } + + public SerializedExceptionPBImpl(SerializedExceptionProto proto) { + this.proto = proto; + viaProto = true; + } + + private SerializedExceptionPBImpl(Throwable t) { + init(t); + } + + public void init(String message) { + maybeInitBuilder(); + builder.setMessage(message); + } + + public void init(Throwable t) { + maybeInitBuilder(); + if (t == null) { + return; + } + + if (t.getCause() == null) { + } else { + builder.setCause(new SerializedExceptionPBImpl(t.getCause()).getProto()); + builder.setClassName(t.getClass().getCanonicalName()); + } + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + t.printStackTrace(pw); + pw.close(); + if (sw.toString() != null) + builder.setTrace(sw.toString()); + if (t.getMessage() != null) + builder.setMessage(t.getMessage()); + } + + public void init(String message, Throwable t) { + init(t); + if (message != null) + builder.setMessage(message); + } + + @Override + public String getMessage() { + SerializedExceptionProtoOrBuilder p = viaProto ? proto : builder; + return p.getMessage(); + } + + @Override + public String getRemoteTrace() { + SerializedExceptionProtoOrBuilder p = viaProto ? proto : builder; + return p.getTrace(); + } + + @Override + public SerializedException getCause() { + SerializedExceptionProtoOrBuilder p = viaProto ? proto : builder; + if (p.hasCause()) { + return new SerializedExceptionPBImpl(p.getCause()); + } else { + return null; + } + } + + public SerializedExceptionProto getProto() { + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = SerializedExceptionProto.newBuilder(proto); + } + viaProto = false; + } +} \ No newline at end of file diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/YarnRemoteException.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/YarnRemoteException.java index 7b4c025..d03f8dd 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/YarnRemoteException.java +++ 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/YarnRemoteExceptionPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/YarnRemoteExceptionPBImpl.java deleted file mode 100644 index 7a00010..0000000 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/YarnRemoteExceptionPBImpl.java +++ /dev/null @@ -1,113 +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.exceptions.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; - -public class YarnRemoteExceptionPBImpl extends YarnRemoteException { - - private static final long serialVersionUID = 1L; - - YarnRemoteExceptionProto proto = YarnRemoteExceptionProto.getDefaultInstance(); - YarnRemoteExceptionProto.Builder builder = null; - boolean viaProto = false; - - public YarnRemoteExceptionPBImpl() { - } - - public YarnRemoteExceptionPBImpl(YarnRemoteExceptionProto proto) { - this.proto = proto; - viaProto = true; - } - - public YarnRemoteExceptionPBImpl(String message) { - super(message); - maybeInitBuilder(); - builder.setMessage(super.getMessage()); - } - - public YarnRemoteExceptionPBImpl(Throwable t) { - super(t); - maybeInitBuilder(); - - if (t.getCause() == null) { - } else { - builder.setCause(new YarnRemoteExceptionPBImpl(t.getCause()).getProto()); - builder.setClassName(t.getClass().getName()); - } - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - t.printStackTrace(pw); - pw.close(); - if (sw.toString() != null) - builder.setTrace(sw.toString()); - if (t.getMessage() != null) - builder.setMessage(t.getMessage()); - } - - public YarnRemoteExceptionPBImpl(String message, Throwable t) { - this(t); - if (message != null) - builder.setMessage(message); - } - @Override - public String getMessage() { - YarnRemoteExceptionProtoOrBuilder p = viaProto ? proto : builder; - return p.getMessage(); - } - - @Override - public String getRemoteTrace() { - YarnRemoteExceptionProtoOrBuilder p = viaProto ? proto : builder; - return p.getTrace(); - } - - @Override - public YarnRemoteException getCause() { - YarnRemoteExceptionProtoOrBuilder p = viaProto ? proto : builder; - if (p.hasCause()) { - return new YarnRemoteExceptionPBImpl(p.getCause()); - } else { - return null; - } - } - - public YarnRemoteExceptionProto getProto() { - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = YarnRemoteExceptionProto.newBuilder(proto); - } - viaProto = false; - } - -} \ No newline at end of file diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/impl/pb/package-info.java 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 5277764..0000000 --- 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto index 212f0ec..23afa11 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto +++ 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml index c573201..66956b3 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml +++ 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 - - - ${basedir}/src/main/proto - - yarnprototunnelrpc.proto - - - ${project.build.directory}/generated-sources/java - - diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/YarnRemoteExceptionFactoryPBImpl.java 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 857c001..0000000 --- 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java deleted file mode 100644 index e6e3b43..0000000 --- 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java index 3926c30..7c190e9 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java @@ -22,45 +22,27 @@ 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 static YarnRemoteException unwrapAndThrowException(ServiceException se) 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java index e6699f3..46f8113 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java @@ -54,6 +54,7 @@ import org.apache.hadoop.yarn.api.records.Priority; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.ResourceRequest; +import org.apache.hadoop.yarn.api.records.SerializedException; import org.apache.hadoop.yarn.api.records.Token; import org.apache.hadoop.yarn.api.records.URL; import org.apache.hadoop.yarn.api.records.YarnApplicationState; @@ -420,4 +421,10 @@ public static AllocateResponse newAllocateResponse(int responseId, return response; } + + public static SerializedException newSerializedException(Throwable e) { + SerializedException se = Records.newRecord(SerializedException.class); + se.init(e); + return se; + } } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/proto/yarnprototunnelrpc.proto hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/proto/yarnprototunnelrpc.proto deleted file mode 100644 index f6a7723..0000000 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/proto/yarnprototunnelrpc.proto +++ /dev/null @@ -1,35 +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. - */ - -option java_package = "org.apache.hadoop.yarn.ipc"; -option java_outer_classname = "RpcProtos"; -option java_generate_equals_and_hash = true; - -import "yarn_protos.proto"; - -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; -} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java index 7454955..2c03c35 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java +++ 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.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 StopContainerResponse stopContainer(StopContainerRequest request) 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java index 92bbb8d..5485927 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java +++ 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.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 @@ private void test(String rpcClass) throws Exception { 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 StopContainerResponse stopContainer(StopContainerRequest request) throws YarnRemoteException { Exception e = new Exception(EXCEPTION_MSG, new Exception(EXCEPTION_CAUSE)); - throw YarnRemoteExceptionFactoryProvider - .getYarnRemoteExceptionFactory(null).createYarnRemoteException(e); + throw new YarnRemoteException(e); } } } diff --git 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 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 91870b4..d3c5a8f 100644 --- 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 +++ 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 @@ -18,19 +18,19 @@ package org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords; import org.apache.hadoop.yarn.api.records.LocalResource; +import org.apache.hadoop.yarn.api.records.SerializedException; import org.apache.hadoop.yarn.api.records.URL; -import org.apache.hadoop.yarn.exceptions.YarnRemoteException; 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 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 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 57f9608..c4c7c6d 100644 --- 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 +++ 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 @@ -19,14 +19,14 @@ import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.hadoop.yarn.api.records.ProtoBase; +import org.apache.hadoop.yarn.api.records.SerializedException; 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.SerializedExceptionPBImpl; 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; @@ -43,7 +43,7 @@ private LocalResource resource; private URL localPath; - private YarnRemoteException exception; + private SerializedException exception; public LocalResourceStatusPBImpl() { builder = LocalResourceStatusProto.newBuilder(); @@ -73,7 +73,7 @@ private void mergeLocalToBuilder() { 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 long getLocalSize() { } @Override - public YarnRemoteException getException() { + public SerializedException getException() { LocalResourceStatusProtoOrBuilder p = viaProto ? proto : builder; if (this.exception != null) { return this.exception; @@ -182,7 +182,7 @@ public void setLocalSize(long size) { } @Override - public void setException(YarnRemoteException exception) { + public void setException(SerializedException exception) { maybeInitBuilder(); if (exception == null) builder.clearException(); @@ -213,12 +213,12 @@ private ResourceStatusType convertFromProtoFormat(ResourceStatusTypeProto e) { 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 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 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 1195763..52fc2d6 100644 --- 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 +++ 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.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.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 @@ 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 void transition(ContainerImpl container, ContainerEvent event) { ContainerResourceFailedEvent rsrcFailedEvent = (ContainerResourceFailedEvent) event; - container.diagnostics.append( - StringUtils.stringifyException(rsrcFailedEvent.getCause())).append( - "\n"); + container.diagnostics.append(rsrcFailedEvent.getCause().getMessage() + + "\n"); + // Inform the localizer to decrement reference counts and cleanup // resources. diff --git 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 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 b9c6372..47a6dca 100644 --- 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 +++ 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 @@ -19,19 +19,20 @@ package org.apache.hadoop.yarn.server.nodemanager.containermanager.container; import org.apache.hadoop.yarn.api.records.ContainerId; +import org.apache.hadoop.yarn.api.records.SerializedException; import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalResourceRequest; public class ContainerResourceFailedEvent extends ContainerResourceEvent { - private final Throwable exception; + private final SerializedException exception; public ContainerResourceFailedEvent(ContainerId container, - LocalResourceRequest rsrc, Throwable cause) { + LocalResourceRequest rsrc, SerializedException cause) { super(container, ContainerEventType.RESOURCE_FAILED, rsrc); this.exception = cause; } - public Throwable getCause() { + public SerializedException getCause() { return exception; } } diff --git 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 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 0e5e398..4b4f147 100644 --- 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 +++ 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.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.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.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.util.BuilderUtils; import org.apache.hadoop.yarn.util.ConverterUtils; import org.apache.hadoop.yarn.util.FSDownload; @@ -295,10 +294,10 @@ private LocalizerStatus createStatus() throws InterruptedException { stat.setStatus(ResourceStatusType.FETCH_SUCCESS); } catch (ExecutionException e) { stat.setStatus(ResourceStatusType.FETCH_FAILURE); - stat.setException(RPCUtil.getRemoteException(e.getCause())); + stat.setException(BuilderUtils.newSerializedException(e.getCause())); } catch (CancellationException e) { stat.setStatus(ResourceStatusType.FETCH_FAILURE); - stat.setException(RPCUtil.getRemoteException(e)); + stat.setException(BuilderUtils.newSerializedException(e)); } // TODO shouldn't remove until ACK i.remove(); diff --git 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 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 22304fc..aa4c576 100644 --- 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 +++ 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; @@ -30,6 +29,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.fs.Path; import org.apache.hadoop.yarn.api.records.ContainerId; +import org.apache.hadoop.yarn.api.records.SerializedException; import org.apache.hadoop.yarn.event.Dispatcher; import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerResourceFailedEvent; @@ -42,7 +42,6 @@ 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,7 +250,7 @@ public void transition(LocalizedResource rsrc, ResourceEvent event) { ResourceFailedLocalizationEvent failedEvent = (ResourceFailedLocalizationEvent) event; Queue containers = rsrc.ref; - Throwable failureCause = failedEvent.getCause(); + SerializedException failureCause = failedEvent.getCause(); for (ContainerId container : containers) { rsrc.dispatcher.getEventHandler().handle( new ContainerResourceFailedEvent(container, failedEvent diff --git 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 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 f9a6778..aaa7a03 100644 --- 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 +++ 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 @@ -111,6 +111,7 @@ import org.apache.hadoop.yarn.server.nodemanager.util.NodeManagerBuilderUtils; import org.apache.hadoop.yarn.service.AbstractService; import org.apache.hadoop.yarn.service.CompositeService; +import org.apache.hadoop.yarn.util.BuilderUtils; import org.apache.hadoop.yarn.util.ConverterUtils; import org.apache.hadoop.yarn.util.FSDownload; @@ -716,8 +717,8 @@ public void run() { 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, + BuilderUtils.newSerializedException(e.getCause()))); assoc.getResource().unlock(); } catch (CancellationException e) { // ignore; shutting down @@ -908,7 +909,8 @@ LocalizerHeartbeatResponse update( 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( @@ -991,7 +993,8 @@ public void run() { // 3.1) notify resource of failed localization ContainerId cId = context.getContainerId(); dispatcher.getEventHandler().handle( - new ContainerResourceFailedEvent(cId, null, e)); + new ContainerResourceFailedEvent(cId, null, BuilderUtils + .newSerializedException(e))); } finally { for (LocalizerResourceRequestEvent event : scheduled.values()) { event.getResource().unlock(); diff --git 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 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 79b28ba..476c5a0 100644 --- 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 +++ 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 @@ -17,6 +17,7 @@ */ package org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event; +import org.apache.hadoop.yarn.api.records.SerializedException; import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalResourceRequest; /** @@ -25,15 +26,15 @@ */ public class ResourceFailedLocalizationEvent extends ResourceEvent { - private Throwable cause; + private final SerializedException cause; public ResourceFailedLocalizationEvent(LocalResourceRequest rsrc, - Throwable cause) { + SerializedException cause) { super(rsrc, ResourceEventType.LOCALIZATION_FAILED); this.cause = cause; } - public Throwable getCause() { + public SerializedException getCause() { return cause; } } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/proto/yarn_server_nodemanager_service_protos.proto hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/proto/yarn_server_nodemanager_service_protos.proto index b1d6ddc..166ea5b 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/proto/yarn_server_nodemanager_service_protos.proto +++ 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java index 39f1f01..283134c 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java +++ 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 void run() { " 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 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 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 71c7f9f..3a4ee71 100644 --- 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 +++ 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.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.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.util.BuilderUtils; import org.apache.hadoop.yarn.util.ConverterUtils; import org.junit.Test; @@ -82,7 +82,7 @@ static LocalResourceStatus createLocalResourceStatus() { e.setStackTrace(new StackTraceElement[] { new StackTraceElement("foo", "bar", "baz", 10), new StackTraceElement("sbb", "one", "onm", 10) }); - ret.setException(RPCUtil.getRemoteException(e)); + ret.setException(BuilderUtils.newSerializedException(e)); return ret; } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java 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 f2fd09e..f488f70 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java +++ 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 void testContainerLaunchFromPreviousRM() throws IOException, "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 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 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 c98379c..45bc0fe 100644 --- 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 +++ 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.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.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 void failLocalizeSpecificResource(String rsrcKey) LocalResourceRequest req = new LocalResourceRequest(rsrc); Exception e = new Exception("Fake localization error"); c.handle(new ContainerResourceFailedEvent(c.getContainer() - .getId(), req, e)); + .getId(), req, BuilderUtils.newSerializedException(e))); drainDispatcherEvents(); } @@ -679,7 +677,7 @@ public void failLocalizeResources(int failRsrcCount) LocalResourceRequest req = new LocalResourceRequest(rsrc.getValue()); Exception e = new Exception("Fake localization error"); c.handle(new ContainerResourceFailedEvent(c.getContainer().getId(), - req, e)); + req, BuilderUtils.newSerializedException(e))); } drainDispatcherEvents(); } diff --git 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 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 cb2a621..1eeab7c 100644 --- 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 +++ 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 @@ -18,8 +18,8 @@ package org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer; import org.apache.hadoop.yarn.api.records.LocalResource; +import org.apache.hadoop.yarn.api.records.SerializedException; import org.apache.hadoop.yarn.api.records.URL; -import org.apache.hadoop.yarn.exceptions.YarnRemoteException; import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalResourceStatus; import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.ResourceStatusType; @@ -29,11 +29,11 @@ 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 @@ @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 @@ @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 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 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 91c6c5e..35db77d 100644 --- 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 +++ 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 @@ -288,7 +288,8 @@ public void testLocalResourceCache() { // Failing resource localization ResourceEvent resourceFailedEvent = - new ResourceFailedLocalizationEvent(lr, new Exception("test")); + new ResourceFailedLocalizationEvent(lr, + BuilderUtils.newSerializedException(new Exception("test"))); // Backing up the resource to track its state change as it will be // removed after the failed event. @@ -420,7 +421,8 @@ public void testHierarchicalLocalCacheDirectories() { Path hierarchicalPath2 = tracker.getPathForLocalization(lr2, localDir); // localization failed. ResourceFailedLocalizationEvent rfe2 = - new ResourceFailedLocalizationEvent(lr2, new Exception("Test")); + new ResourceFailedLocalizationEvent(lr2, + BuilderUtils.newSerializedException(new Exception("Test"))); tracker.handle(rfe2); /* diff --git 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 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 90c8063..314b801 100644 --- 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 +++ 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.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; @@ -1012,7 +1012,8 @@ private LocalizerStatus createLocalizerStatusForFailedResource( String localizerId, LocalResourceRequest req) { LocalizerStatus status = createLocalizerStatus(localizerId); LocalResourceStatus resourceStatus = new LocalResourceStatusPBImpl(); - resourceStatus.setException(new YarnRemoteExceptionPBImpl("test")); + resourceStatus.setException(BuilderUtils + .newSerializedException(new YarnRemoteException("test"))); resourceStatus.setStatus(ResourceStatusType.FETCH_FAILURE); resourceStatus.setResource(req); status.addResourceStatus(resourceStatus); @@ -1146,7 +1147,8 @@ public void testParallelDownloadAttemptsForPublicResource() throws Exception { // 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, + BuilderUtils.newSerializedException(new Exception("test"))); spyService.getLocalResourcesTracker(LocalResourceVisibility.PUBLIC, user, null).handle(locFailedEvent); diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java index 73ccc03..6d44661 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java +++ 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 void testRMAppSubmitInvalidResourceRequest() throws Exception { " 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 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java index d25f0f9..577ea0a 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java +++ 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 Void run() throws Exception { 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; } }