svn merge -c 1401703 FIXES: YARN-180. Capacity scheduler - containers that get reserved create container token to early (acmurthy and bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1401705 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Joseph Evans 2012-10-24 14:20:09 +00:00
parent bc6fbf8b74
commit c4defd0cff
2 changed files with 30 additions and 18 deletions

View File

@ -162,6 +162,9 @@ Release 0.23.5 - UNRELEASED
YARN-178. Fix custom ProcessTree instance creation (Radim Kolar via bobby) YARN-178. Fix custom ProcessTree instance creation (Radim Kolar via bobby)
YARN-180. Capacity scheduler - containers that get reserved create
container token to early (acmurthy and bobby)
Release 0.23.4 - UNRELEASED Release 0.23.4 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -1188,34 +1188,32 @@ public class LeafQueue implements CSQueue {
return (rmContainer != null) ? rmContainer.getContainer() : return (rmContainer != null) ? rmContainer.getContainer() :
createContainer(application, node, capability, priority); createContainer(application, node, capability, priority);
} }
public Container createContainer(FiCaSchedulerApp application, FiCaSchedulerNode node, Container createContainer(FiCaSchedulerApp application, FiCaSchedulerNode node,
Resource capability, Priority priority) { Resource capability, Priority priority) {
NodeId nodeId = node.getRMNode().getNodeID(); NodeId nodeId = node.getRMNode().getNodeID();
ContainerId containerId = BuilderUtils.newContainerId(application ContainerId containerId = BuilderUtils.newContainerId(application
.getApplicationAttemptId(), application.getNewContainerId()); .getApplicationAttemptId(), application.getNewContainerId());
ContainerToken containerToken = null;
// If security is enabled, send the container-tokens too.
if (UserGroupInformation.isSecurityEnabled()) {
containerToken =
containerTokenSecretManager.createContainerToken(containerId, nodeId,
application.getUser(), capability);
if (containerToken == null) {
return null; // Try again later.
}
}
// Create the container // Create the container
Container container = BuilderUtils.newContainer(containerId, nodeId, Container container = BuilderUtils.newContainer(containerId, nodeId,
node.getRMNode().getHttpAddress(), capability, priority, node.getRMNode().getHttpAddress(), capability, priority,
containerToken); null);
return container; return container;
} }
/**
* Create <code>ContainerToken</code>, only in secure-mode
*/
ContainerToken createContainerToken(
FiCaSchedulerApp application, Container container) {
return containerTokenSecretManager.createContainerToken(
container.getId(), container.getNodeId(),
application.getUser(), container.getResource());
}
private Resource assignContainer(Resource clusterResource, FiCaSchedulerNode node, private Resource assignContainer(Resource clusterResource, FiCaSchedulerNode node,
FiCaSchedulerApp application, Priority priority, FiCaSchedulerApp application, Priority priority,
ResourceRequest request, NodeType type, RMContainer rmContainer) { ResourceRequest request, NodeType type, RMContainer rmContainer) {
@ -1251,6 +1249,17 @@ public class LeafQueue implements CSQueue {
unreserve(application, priority, node, rmContainer); unreserve(application, priority, node, rmContainer);
} }
// Create container tokens in secure-mode
if (UserGroupInformation.isSecurityEnabled()) {
ContainerToken containerToken =
createContainerToken(application, container);
if (containerToken == null) {
// Something went wrong...
return Resources.none();
}
container.setContainerToken(containerToken);
}
// Inform the application // Inform the application
RMContainer allocatedContainer = RMContainer allocatedContainer =
application.allocate(type, node, priority, request, container); application.allocate(type, node, priority, request, container);