YARN-632. Changed ContainerManager api to throw IOException and YarnRemoteException. Contributed by Xuan Gong.
svn merge --ignore-ancestry -c 1479740 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1479741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c114469fbd
commit
2136542f1b
|
@ -37,6 +37,9 @@ Release 2.0.5-beta - UNRELEASED
|
||||||
YARN-633. Changed RMAdminProtocol api to throw IOException and
|
YARN-633. Changed RMAdminProtocol api to throw IOException and
|
||||||
YarnRemoteException. (Xuan Gong via vinodkv)
|
YarnRemoteException. (Xuan Gong via vinodkv)
|
||||||
|
|
||||||
|
YARN-632. Changed ContainerManager api to throw IOException and
|
||||||
|
YarnRemoteException. (Xuan Gong via vinodkv)
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
|
|
||||||
YARN-482. FS: Extend SchedulingMode to intermediate queues.
|
YARN-482. FS: Extend SchedulingMode to intermediate queues.
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.api;
|
package org.apache.hadoop.yarn.api;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Stable;
|
import org.apache.hadoop.classification.InterfaceStability.Stable;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusRequest;
|
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusRequest;
|
||||||
|
@ -68,11 +70,12 @@ public interface ContainerManager {
|
||||||
* @return empty response to indicate acceptance of the request
|
* @return empty response to indicate acceptance of the request
|
||||||
* or an exception
|
* or an exception
|
||||||
* @throws YarnRemoteException
|
* @throws YarnRemoteException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
StartContainerResponse startContainer(StartContainerRequest request)
|
StartContainerResponse startContainer(StartContainerRequest request)
|
||||||
throws YarnRemoteException;
|
throws YarnRemoteException, IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>The <code>ApplicationMaster</code> requests a <code>NodeManager</code>
|
* <p>The <code>ApplicationMaster</code> requests a <code>NodeManager</code>
|
||||||
|
@ -94,11 +97,12 @@ public interface ContainerManager {
|
||||||
* @return empty response to indicate acceptance of the request
|
* @return empty response to indicate acceptance of the request
|
||||||
* or an exception
|
* or an exception
|
||||||
* @throws YarnRemoteException
|
* @throws YarnRemoteException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
StopContainerResponse stopContainer(StopContainerRequest request)
|
StopContainerResponse stopContainer(StopContainerRequest request)
|
||||||
throws YarnRemoteException;
|
throws YarnRemoteException, IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>The api used by the <code>ApplicationMaster</code> to request for
|
* <p>The api used by the <code>ApplicationMaster</code> to request for
|
||||||
|
@ -118,9 +122,11 @@ public interface ContainerManager {
|
||||||
* @return response containing the <code>ContainerStatus</code> of the
|
* @return response containing the <code>ContainerStatus</code> of the
|
||||||
* container
|
* container
|
||||||
* @throws YarnRemoteException
|
* @throws YarnRemoteException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
GetContainerStatusResponse getContainerStatus(
|
GetContainerStatusResponse getContainerStatus(
|
||||||
GetContainerStatusRequest request) throws YarnRemoteException;
|
GetContainerStatusRequest request) throws YarnRemoteException,
|
||||||
|
IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -759,6 +759,10 @@ public class ApplicationMaster {
|
||||||
+ container.getId());
|
+ container.getId());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// TODO do we need to release this container?
|
// TODO do we need to release this container?
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.info("Start container failed for :" + ", containerId="
|
||||||
|
+ container.getId());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get container status?
|
// Get container status?
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.api.impl.pb.service;
|
package org.apache.hadoop.yarn.api.impl.pb.service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.yarn.api.ContainerManager;
|
import org.apache.hadoop.yarn.api.ContainerManager;
|
||||||
import org.apache.hadoop.yarn.api.ContainerManagerPB;
|
import org.apache.hadoop.yarn.api.ContainerManagerPB;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusResponse;
|
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusResponse;
|
||||||
|
@ -57,6 +59,8 @@ public class ContainerManagerPBServiceImpl implements ContainerManagerPB {
|
||||||
return ((GetContainerStatusResponsePBImpl)response).getProto();
|
return ((GetContainerStatusResponsePBImpl)response).getProto();
|
||||||
} catch (YarnRemoteException e) {
|
} catch (YarnRemoteException e) {
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ServiceException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +73,8 @@ public class ContainerManagerPBServiceImpl implements ContainerManagerPB {
|
||||||
return ((StartContainerResponsePBImpl)response).getProto();
|
return ((StartContainerResponsePBImpl)response).getProto();
|
||||||
} catch (YarnRemoteException e) {
|
} catch (YarnRemoteException e) {
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ServiceException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +87,8 @@ public class ContainerManagerPBServiceImpl implements ContainerManagerPB {
|
||||||
return ((StopContainerResponsePBImpl)response).getProto();
|
return ((StopContainerResponsePBImpl)response).getProto();
|
||||||
} catch (YarnRemoteException e) {
|
} catch (YarnRemoteException e) {
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ServiceException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -396,7 +396,7 @@ public class ContainerManagerImpl extends CompositeService implements
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public StartContainerResponse startContainer(StartContainerRequest request)
|
public StartContainerResponse startContainer(StartContainerRequest request)
|
||||||
throws YarnRemoteException {
|
throws YarnRemoteException, IOException {
|
||||||
|
|
||||||
if (blockNewContainerRequests.get()) {
|
if (blockNewContainerRequests.get()) {
|
||||||
throw RPCUtil.getRemoteException(new NMNotYetReadyException(
|
throw RPCUtil.getRemoteException(new NMNotYetReadyException(
|
||||||
|
@ -503,7 +503,7 @@ public class ContainerManagerImpl extends CompositeService implements
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public StopContainerResponse stopContainer(StopContainerRequest request)
|
public StopContainerResponse stopContainer(StopContainerRequest request)
|
||||||
throws YarnRemoteException {
|
throws YarnRemoteException, IOException {
|
||||||
|
|
||||||
ContainerId containerID = request.getContainerId();
|
ContainerId containerID = request.getContainerId();
|
||||||
String containerIDStr = containerID.toString();
|
String containerIDStr = containerID.toString();
|
||||||
|
@ -545,7 +545,8 @@ public class ContainerManagerImpl extends CompositeService implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GetContainerStatusResponse getContainerStatus(
|
public GetContainerStatusResponse getContainerStatus(
|
||||||
GetContainerStatusRequest request) throws YarnRemoteException {
|
GetContainerStatusRequest request) throws YarnRemoteException,
|
||||||
|
IOException {
|
||||||
|
|
||||||
ContainerId containerID = request.getContainerId();
|
ContainerId containerID = request.getContainerId();
|
||||||
String containerIDStr = containerID.toString();
|
String containerIDStr = containerID.toString();
|
||||||
|
|
|
@ -299,6 +299,8 @@ public class TestNodeManagerResync {
|
||||||
// class name after YARN-142
|
// class name after YARN-142
|
||||||
Assert.assertTrue(e.getRemoteTrace().contains(
|
Assert.assertTrue(e.getRemoteTrace().contains(
|
||||||
NMNotYetReadyException.class.getName()));
|
NMNotYetReadyException.class.getName()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
assertionFailedInThread.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no. of containers to be launched should equal to no. of
|
// no. of containers to be launched should equal to no. of
|
||||||
|
|
|
@ -185,13 +185,13 @@ public abstract class BaseContainerManagerTest {
|
||||||
|
|
||||||
public static void waitForContainerState(ContainerManager containerManager,
|
public static void waitForContainerState(ContainerManager containerManager,
|
||||||
ContainerId containerID, ContainerState finalState)
|
ContainerId containerID, ContainerState finalState)
|
||||||
throws InterruptedException, YarnRemoteException {
|
throws InterruptedException, YarnRemoteException, IOException {
|
||||||
waitForContainerState(containerManager, containerID, finalState, 20);
|
waitForContainerState(containerManager, containerID, finalState, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void waitForContainerState(ContainerManager containerManager,
|
public static void waitForContainerState(ContainerManager containerManager,
|
||||||
ContainerId containerID, ContainerState finalState, int timeOutMax)
|
ContainerId containerID, ContainerState finalState, int timeOutMax)
|
||||||
throws InterruptedException, YarnRemoteException {
|
throws InterruptedException, YarnRemoteException, IOException {
|
||||||
GetContainerStatusRequest request =
|
GetContainerStatusRequest request =
|
||||||
recordFactory.newRecordInstance(GetContainerStatusRequest.class);
|
recordFactory.newRecordInstance(GetContainerStatusRequest.class);
|
||||||
request.setContainerId(containerID);
|
request.setContainerId(containerID);
|
||||||
|
|
|
@ -531,6 +531,9 @@ public class TestContainerManagerSecurity {
|
||||||
"Unauthorized request to start container. "
|
"Unauthorized request to start container. "
|
||||||
+ "\nExpected containerId: " + tokenId.getContainerID()
|
+ "\nExpected containerId: " + tokenId.getContainerID()
|
||||||
+ " Found: " + newContainerId.toString()));
|
+ " Found: " + newContainerId.toString()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.info("Got IOException: ",e);
|
||||||
|
fail("IOException is not expected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,6 +560,9 @@ public class TestContainerManagerSecurity {
|
||||||
Assert.assertTrue(e.getMessage().contains(
|
Assert.assertTrue(e.getMessage().contains(
|
||||||
"\nExpected resource " + tokenId.getResource().toString()
|
"\nExpected resource " + tokenId.getResource().toString()
|
||||||
+ " but found " + container.getResource().toString()));
|
+ " but found " + container.getResource().toString()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.info("Got IOException: ",e);
|
||||||
|
fail("IOException is not expected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,6 +591,9 @@ public class TestContainerManagerSecurity {
|
||||||
Assert.assertTrue(e.getMessage().contains(
|
Assert.assertTrue(e.getMessage().contains(
|
||||||
"Expected user-name " + tokenId.getApplicationSubmitter()
|
"Expected user-name " + tokenId.getApplicationSubmitter()
|
||||||
+ " but found " + context.getUser()));
|
+ " but found " + context.getUser()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.info("Got IOException: ",e);
|
||||||
|
fail("IOException is not expected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue