MAPREDUCE-5286. Change MapReduce to use ContainerTokenIdentifier instead of the entire Container in the startContainer call - YARN-684. Contributed by Vinod Kumar Vavilapalli.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1488087 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2692675fc3
commit
f3f7a11336
|
@ -447,6 +447,10 @@ Release 2.0.5-beta - UNRELEASED
|
||||||
MAPREDUCE-5282. Updating MR App to use immutable ApplicationID after
|
MAPREDUCE-5282. Updating MR App to use immutable ApplicationID after
|
||||||
YARN-716. (Siddharth Seth via vinodkv)
|
YARN-716. (Siddharth Seth via vinodkv)
|
||||||
|
|
||||||
|
MAPREDUCE-5286. Change MapReduce to use ContainerTokenIdentifier instead
|
||||||
|
of the entire Container in the startContainer call - YARN-684.
|
||||||
|
(Vinod Kumar Vavilapalli via sseth)
|
||||||
|
|
||||||
BREAKDOWN OF HADOOP-8562 SUBTASKS
|
BREAKDOWN OF HADOOP-8562 SUBTASKS
|
||||||
|
|
||||||
MAPREDUCE-4739. Some MapReduce tests fail to find winutils.
|
MAPREDUCE-4739. Some MapReduce tests fail to find winutils.
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class ContainerLauncherImpl extends AbstractService implements
|
||||||
StartContainerRequest startRequest = Records
|
StartContainerRequest startRequest = Records
|
||||||
.newRecord(StartContainerRequest.class);
|
.newRecord(StartContainerRequest.class);
|
||||||
startRequest.setContainerLaunchContext(containerLaunchContext);
|
startRequest.setContainerLaunchContext(containerLaunchContext);
|
||||||
startRequest.setContainer(event.getAllocatedContainer());
|
startRequest.setContainerToken(event.getContainerToken());
|
||||||
StartContainerResponse response = proxy.startContainer(startRequest);
|
StartContainerResponse response = proxy.startContainer(startRequest);
|
||||||
|
|
||||||
ByteBuffer portInfo =
|
ByteBuffer portInfo =
|
||||||
|
|
|
@ -90,14 +90,17 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.Container;
|
import org.apache.hadoop.yarn.api.records.Container;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ContainerToken;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
import org.apache.hadoop.yarn.event.EventHandler;
|
import org.apache.hadoop.yarn.event.EventHandler;
|
||||||
import org.apache.hadoop.yarn.factories.RecordFactory;
|
import org.apache.hadoop.yarn.factories.RecordFactory;
|
||||||
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
||||||
|
import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
|
||||||
import org.apache.hadoop.yarn.service.Service;
|
import org.apache.hadoop.yarn.service.Service;
|
||||||
import org.apache.hadoop.yarn.state.StateMachine;
|
import org.apache.hadoop.yarn.state.StateMachine;
|
||||||
import org.apache.hadoop.yarn.state.StateMachineFactory;
|
import org.apache.hadoop.yarn.state.StateMachineFactory;
|
||||||
|
import org.apache.hadoop.yarn.util.BuilderUtils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -512,12 +515,19 @@ public class MRApp extends MRAppMaster {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(ContainerAllocatorEvent event) {
|
public void handle(ContainerAllocatorEvent event) {
|
||||||
ContainerId cId = recordFactory.newRecordInstance(ContainerId.class);
|
ContainerId cId =
|
||||||
cId.setApplicationAttemptId(getContext().getApplicationAttemptId());
|
ContainerId.newInstance(getContext().getApplicationAttemptId(),
|
||||||
cId.setId(containerCount++);
|
containerCount++);
|
||||||
NodeId nodeId = NodeId.newInstance(NM_HOST, NM_PORT);
|
NodeId nodeId = NodeId.newInstance(NM_HOST, NM_PORT);
|
||||||
|
Resource resource = Resource.newInstance(1234, 2);
|
||||||
|
ContainerTokenIdentifier containerTokenIdentifier =
|
||||||
|
new ContainerTokenIdentifier(cId, nodeId.toString(), "user",
|
||||||
|
resource, System.currentTimeMillis() + 10000, 42, 42);
|
||||||
|
ContainerToken containerToken =
|
||||||
|
BuilderUtils.newContainerToken(nodeId, "password".getBytes(),
|
||||||
|
containerTokenIdentifier);
|
||||||
Container container = Container.newInstance(cId, nodeId,
|
Container container = Container.newInstance(cId, nodeId,
|
||||||
NM_HOST + ":" + NM_HTTP_PORT, null, null, null);
|
NM_HOST + ":" + NM_HTTP_PORT, resource, null, containerToken);
|
||||||
JobID id = TypeConverter.fromYarn(applicationId);
|
JobID id = TypeConverter.fromYarn(applicationId);
|
||||||
JobId jobId = TypeConverter.toYarn(id);
|
JobId jobId = TypeConverter.toYarn(id);
|
||||||
getContext().getEventHandler().handle(new JobHistoryEvent(jobId,
|
getContext().getEventHandler().handle(new JobHistoryEvent(jobId,
|
||||||
|
|
|
@ -67,6 +67,7 @@ import org.apache.hadoop.yarn.factories.RecordFactory;
|
||||||
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
||||||
import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
|
import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
|
||||||
import org.apache.hadoop.yarn.ipc.YarnRPC;
|
import org.apache.hadoop.yarn.ipc.YarnRPC;
|
||||||
|
import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
|
||||||
import org.apache.hadoop.yarn.util.BuilderUtils;
|
import org.apache.hadoop.yarn.util.BuilderUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -376,13 +377,12 @@ public class TestContainerLauncher {
|
||||||
public StartContainerResponse startContainer(StartContainerRequest request)
|
public StartContainerResponse startContainer(StartContainerRequest request)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
|
ContainerTokenIdentifier containerTokenIdentifier =
|
||||||
|
BuilderUtils.newContainerTokenIdentifier(request.getContainerToken());
|
||||||
|
|
||||||
// Validate that the container is what RM is giving.
|
// Validate that the container is what RM is giving.
|
||||||
Assert.assertEquals(MRApp.NM_HOST, request.getContainer().getNodeId()
|
Assert.assertEquals(MRApp.NM_HOST + ":" + MRApp.NM_PORT,
|
||||||
.getHost());
|
containerTokenIdentifier.getNmHostAddress());
|
||||||
Assert.assertEquals(MRApp.NM_PORT, request.getContainer().getNodeId()
|
|
||||||
.getPort());
|
|
||||||
Assert.assertEquals(MRApp.NM_HOST + ":" + MRApp.NM_HTTP_PORT, request
|
|
||||||
.getContainer().getNodeHttpAddress());
|
|
||||||
|
|
||||||
StartContainerResponse response = recordFactory
|
StartContainerResponse response = recordFactory
|
||||||
.newRecordInstance(StartContainerResponse.class);
|
.newRecordInstance(StartContainerResponse.class);
|
||||||
|
@ -395,7 +395,7 @@ public class TestContainerLauncher {
|
||||||
throw new UndeclaredThrowableException(e);
|
throw new UndeclaredThrowableException(e);
|
||||||
}
|
}
|
||||||
status.setState(ContainerState.RUNNING);
|
status.setState(ContainerState.RUNNING);
|
||||||
status.setContainerId(request.getContainer().getId());
|
status.setContainerId(containerTokenIdentifier.getContainerID());
|
||||||
status.setExitStatus(0);
|
status.setExitStatus(0);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue