YARN-737. Throw some specific exceptions directly instead of wrapping them in YarnException. Contributed by Jian He.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1491896 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a841be808a
commit
c6c41abf68
|
@ -309,6 +309,9 @@ Release 2.1.0-beta - UNRELEASED
|
|||
|
||||
YARN-686. Flatten NodeReport. (sandyr via tucu)
|
||||
|
||||
YARN-737. Throw some specific exceptions directly instead of wrapping them
|
||||
in YarnException. (Jian He via sseth)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
YARN-512. Log aggregation root directory check is more expensive than it
|
||||
|
|
|
@ -184,7 +184,6 @@ public class TestRPC {
|
|||
|
||||
try {
|
||||
tokenId = newContainerTokenIdentifier(containerToken);
|
||||
tokenId = new ContainerTokenIdentifier();
|
||||
} catch (IOException e) {
|
||||
throw RPCUtil.getRemoteException(e);
|
||||
}
|
||||
|
|
|
@ -394,9 +394,9 @@ public class ContainerManagerImpl extends CompositeService implements
|
|||
throws YarnException, IOException {
|
||||
|
||||
if (blockNewContainerRequests.get()) {
|
||||
throw RPCUtil.getRemoteException(new NMNotYetReadyException(
|
||||
throw new NMNotYetReadyException(
|
||||
"Rejecting new containers as NodeManager has not" +
|
||||
" yet connected with ResourceManager"));
|
||||
" yet connected with ResourceManager");
|
||||
}
|
||||
|
||||
ContainerLaunchContext launchContext = request.getContainerLaunchContext();
|
||||
|
@ -424,8 +424,7 @@ public class ContainerManagerImpl extends CompositeService implements
|
|||
String msg = "\nContainer "+ containerIDStr
|
||||
+ " rejected as it is allocated by a previous RM";
|
||||
LOG.error(msg);
|
||||
throw RPCUtil
|
||||
.getRemoteException(new InvalidContainerException(msg));
|
||||
throw new InvalidContainerException(msg);
|
||||
}
|
||||
|
||||
LOG.info("Start request for " + containerIDStr + " by user "
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
|
||||
package org.apache.hadoop.yarn.server.nodemanager.containermanager;
|
||||
|
||||
import org.apache.hadoop.yarn.YarnRuntimeException;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
|
||||
|
||||
/**
|
||||
* This Exception happens when NM is rejecting container requests from RM
|
||||
*/
|
||||
public class InvalidContainerException extends YarnRuntimeException {
|
||||
public class InvalidContainerException extends YarnException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
package org.apache.hadoop.yarn.server.nodemanager.containermanager;
|
||||
|
||||
import org.apache.hadoop.yarn.YarnRuntimeException;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
|
||||
/**
|
||||
* This exception happens when NM starts from scratch but has not yet connected
|
||||
* with RM.
|
||||
*/
|
||||
public class NMNotYetReadyException extends YarnRuntimeException {
|
||||
public class NMNotYetReadyException extends YarnException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
|
@ -293,10 +293,8 @@ public class TestNodeManagerResync {
|
|||
Assert.assertTrue(e.getMessage().contains(
|
||||
"Rejecting new containers as NodeManager has not" +
|
||||
" yet connected with ResourceManager"));
|
||||
// TO DO: This should be replaced to explicitly check exception
|
||||
// class name after YARN-142
|
||||
Assert.assertTrue(e.getMessage().contains(
|
||||
NMNotYetReadyException.class.getName()));
|
||||
Assert.assertEquals(NMNotYetReadyException.class.getName(), e
|
||||
.getClass().getName());
|
||||
} catch (IOException e) {
|
||||
assertionFailedInThread.set(true);
|
||||
}
|
||||
|
|
|
@ -528,10 +528,8 @@ public class TestContainerManager extends BaseContainerManagerTest {
|
|||
catchException = true;
|
||||
Assert.assertTrue(e.getMessage().contains(
|
||||
"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.getMessage().contains(
|
||||
InvalidContainerException.class.getName()));
|
||||
Assert.assertEquals(InvalidContainerException.class.getName(), e
|
||||
.getClass().getName());
|
||||
}
|
||||
|
||||
// Verify that startContainer fail because of invalid container request
|
||||
|
|
|
@ -258,7 +258,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
|||
} catch (InvalidResourceRequestException e) {
|
||||
LOG.warn("RM app submission failed in validating AM resource request"
|
||||
+ " for application " + applicationId, e);
|
||||
throw RPCUtil.getRemoteException(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -363,10 +363,10 @@ public class MiniYARNCluster extends CompositeService {
|
|||
NodeHeartbeatResponse.class);
|
||||
try {
|
||||
response = rt.nodeHeartbeat(request);
|
||||
} catch (YarnException ioe) {
|
||||
} catch (YarnException e) {
|
||||
LOG.info("Exception in heartbeat from node " +
|
||||
request.getNodeStatus().getNodeId(), ioe);
|
||||
throw RPCUtil.getRemoteException(ioe);
|
||||
request.getNodeStatus().getNodeId(), e);
|
||||
throw e;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
@ -379,10 +379,10 @@ public class MiniYARNCluster extends CompositeService {
|
|||
newRecordInstance(RegisterNodeManagerResponse.class);
|
||||
try {
|
||||
response = rt.registerNodeManager(request);
|
||||
} catch (YarnException ioe) {
|
||||
} catch (YarnException e) {
|
||||
LOG.info("Exception in node registration from "
|
||||
+ request.getNodeId().toString(), ioe);
|
||||
throw RPCUtil.getRemoteException(ioe);
|
||||
+ request.getNodeId().toString(), e);
|
||||
throw e;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue