merge YARN-737 from trunk. 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/branches/branch-2@1491897 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Siddharth Seth 2013-06-11 18:48:00 +00:00
parent ff2dcbc408
commit 05ff189ee1
9 changed files with 22 additions and 24 deletions

View File

@ -289,6 +289,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

View File

@ -184,7 +184,6 @@ public class TestRPC {
try {
tokenId = newContainerTokenIdentifier(containerToken);
tokenId = new ContainerTokenIdentifier();
} catch (IOException e) {
throw RPCUtil.getRemoteException(e);
}

View File

@ -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 "

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;
}