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