YARN-634. Modified YarnRemoteException to be not backed by PB and introduced a separate SerializedException record. Contributed by Siddharth Seth.
MAPREDUCE-5239. Updated MR App to reflect YarnRemoteException changes after YARN-634. Contributed by Siddharth Seth. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1481205 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
945cb2ecaa
commit
2638bc67a4
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -443,11 +443,6 @@ public class TestContainerLauncherImpl {
|
|||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteTrace() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YarnRemoteException getCause() {
|
||||
return null;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -277,4 +277,10 @@
|
|||
<Bug pattern="BC_UNCONFIRMED_CAST" />
|
||||
</Match>
|
||||
|
||||
<!-- Ignore SerializedException does not extend Exception -->
|
||||
<Match>
|
||||
<Class name="org.apache.hadoop.yarn.server.api.records.SerializedException" />
|
||||
<Bug pattern="NM_CLASS_NOT_EXCEPTION" />
|
||||
</Match>
|
||||
|
||||
</FindBugsFilter>
|
||||
|
|
|
@ -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(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public YarnRemoteException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public YarnRemoteException(String message) {
|
||||
super(message);
|
||||
public YarnRemoteException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace(PrintWriter pw) {
|
||||
pw.append("RemoteTrace: \n").append(getRemoteTrace())
|
||||
.append(" at LocalTrace: \n\t");
|
||||
super.printStackTrace(pw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace(PrintStream ps) {
|
||||
ps.append("RemoteTrace: \n").append(getRemoteTrace())
|
||||
.append(" at Local Trace: \n\t");
|
||||
super.printStackTrace(ps);
|
||||
}
|
||||
|
||||
public abstract String getRemoteTrace();
|
||||
|
||||
public abstract YarnRemoteException getCause();
|
||||
}
|
|
@ -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;
|
|
@ -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 {
|
||||
|
|
|
@ -107,27 +107,6 @@
|
|||
</source>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<imports>
|
||||
<param>${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/../hadoop-yarn-api/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>yarnprototunnelrpc.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,43 +22,25 @@ 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);
|
||||
}
|
||||
|
||||
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()));
|
||||
return new YarnRemoteException(message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -70,34 +70,35 @@ public class YarnRemoteExceptionPBImpl extends YarnRemoteException {
|
|||
builder.setMessage(t.getMessage());
|
||||
}
|
||||
|
||||
public YarnRemoteExceptionPBImpl(String message, Throwable t) {
|
||||
this(t);
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<LocalResourceRequest,List<String>> pendingResources =
|
||||
new HashMap<LocalResourceRequest,List<String>>();
|
||||
private final Map<Path,List<String>> 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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<ResourceEvent> {
|
|||
ResourceFailedLocalizationEvent failedEvent =
|
||||
(ResourceFailedLocalizationEvent) event;
|
||||
Queue<ContainerId> containers = rsrc.ref;
|
||||
Throwable failureCause = failedEvent.getCause();
|
||||
for (ContainerId container : containers) {
|
||||
rsrc.dispatcher.getEventHandler().handle(
|
||||
new ContainerResourceFailedEvent(container, failedEvent
|
||||
.getLocalResourceRequest(), failureCause));
|
||||
.getLocalResourceRequest(), failedEvent.getDiagnosticMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue