YARN-618. Modified RM_INVALID_IDENTIFIER to be -1 instead of zero. Contributed by Jian He.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1478230 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1ea3bdaa06
commit
46b2898a1a
@ -201,6 +201,9 @@ Release 2.0.5-beta - UNRELEASED
|
|||||||
to separate out various validation checks depending on whether they rely on
|
to separate out various validation checks depending on whether they rely on
|
||||||
RM configuration or not. (Zhijie Shen via vinodkv)
|
RM configuration or not. (Zhijie Shen via vinodkv)
|
||||||
|
|
||||||
|
YARN-618. Modified RM_INVALID_IDENTIFIER to be -1 instead of zero. (Jian He
|
||||||
|
via vinodkv)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
@ -20,5 +20,10 @@ package org.apache.hadoop.yarn.server.api;
|
|||||||
|
|
||||||
public interface ResourceManagerConstants {
|
public interface ResourceManagerConstants {
|
||||||
|
|
||||||
public static final long RM_INVALID_IDENTIFIER = 0;
|
/**
|
||||||
|
* This states the invalid identifier of Resource Manager. This is used as a
|
||||||
|
* default value for initializing RM identifier. Currently, RM is using time
|
||||||
|
* stamp as RM identifier.
|
||||||
|
*/
|
||||||
|
public static final long RM_INVALID_IDENTIFIER = -1;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ public class TestEventFlow {
|
|||||||
TestEventFlow.class.getName() + "-localLogDir").getAbsoluteFile();
|
TestEventFlow.class.getName() + "-localLogDir").getAbsoluteFile();
|
||||||
private static File remoteLogDir = new File("target",
|
private static File remoteLogDir = new File("target",
|
||||||
TestEventFlow.class.getName() + "-remoteLogDir").getAbsoluteFile();
|
TestEventFlow.class.getName() + "-remoteLogDir").getAbsoluteFile();
|
||||||
|
private static final long SIMULATED_RM_IDENTIFIER = 1234;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccessfulContainerLaunch() throws InterruptedException,
|
public void testSuccessfulContainerLaunch() throws InterruptedException,
|
||||||
@ -100,6 +101,11 @@ public class TestEventFlow {
|
|||||||
protected void startStatusUpdater() {
|
protected void startStatusUpdater() {
|
||||||
return; // Don't start any updating thread.
|
return; // Don't start any updating thread.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getRMIdentifier() {
|
||||||
|
return SIMULATED_RM_IDENTIFIER;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
DummyContainerManager containerManager =
|
DummyContainerManager containerManager =
|
||||||
@ -124,6 +130,8 @@ public class TestEventFlow {
|
|||||||
when(mockContainer.getId()).thenReturn(cID);
|
when(mockContainer.getId()).thenReturn(cID);
|
||||||
when(mockContainer.getResource()).thenReturn(recordFactory
|
when(mockContainer.getResource()).thenReturn(recordFactory
|
||||||
.newRecordInstance(Resource.class));
|
.newRecordInstance(Resource.class));
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(SIMULATED_RM_IDENTIFIER);
|
||||||
|
|
||||||
launchContext.setUser("testing");
|
launchContext.setUser("testing");
|
||||||
StartContainerRequest request =
|
StartContainerRequest request =
|
||||||
recordFactory.newRecordInstance(StartContainerRequest.class);
|
recordFactory.newRecordInstance(StartContainerRequest.class);
|
||||||
|
@ -98,6 +98,7 @@ public abstract class BaseContainerManagerTest {
|
|||||||
protected String user = "nobody";
|
protected String user = "nobody";
|
||||||
protected NodeHealthCheckerService nodeHealthChecker;
|
protected NodeHealthCheckerService nodeHealthChecker;
|
||||||
protected LocalDirsHandlerService dirsHandler;
|
protected LocalDirsHandlerService dirsHandler;
|
||||||
|
protected final long DUMMY_RM_IDENTIFIER = 1234;
|
||||||
|
|
||||||
protected NodeStatusUpdater nodeStatusUpdater = new NodeStatusUpdaterImpl(
|
protected NodeStatusUpdater nodeStatusUpdater = new NodeStatusUpdaterImpl(
|
||||||
context, new AsyncDispatcher(), null, metrics) {
|
context, new AsyncDispatcher(), null, metrics) {
|
||||||
@ -110,6 +111,12 @@ public abstract class BaseContainerManagerTest {
|
|||||||
protected void startStatusUpdater() {
|
protected void startStatusUpdater() {
|
||||||
return; // Don't start any updating thread.
|
return; // Don't start any updating thread.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getRMIdentifier() {
|
||||||
|
// There is no real RM registration, simulate and set RMIdentifier
|
||||||
|
return DUMMY_RM_IDENTIFIER;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected ContainerManagerImpl containerManager = null;
|
protected ContainerManagerImpl containerManager = null;
|
||||||
|
@ -26,7 +26,6 @@ import java.io.File;
|
|||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -58,12 +57,8 @@ import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
|||||||
import org.apache.hadoop.yarn.server.api.ResourceManagerConstants;
|
import org.apache.hadoop.yarn.server.api.ResourceManagerConstants;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent;
|
import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor.ExitCode;
|
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor.ExitCode;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor.Signal;
|
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor;
|
import org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
|
import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.LocalRMInterface;
|
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdater;
|
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdaterImpl;
|
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationState;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationState;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ContainerLocalizer;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ContainerLocalizer;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService;
|
||||||
@ -161,6 +156,7 @@ public class TestContainerManager extends BaseContainerManagerTest {
|
|||||||
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
||||||
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
||||||
context.getNodeId().getHost() + ":12345");
|
context.getNodeId().getHost() + ":12345");
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER);
|
||||||
|
|
||||||
StartContainerRequest startRequest =
|
StartContainerRequest startRequest =
|
||||||
recordFactory.newRecordInstance(StartContainerRequest.class);
|
recordFactory.newRecordInstance(StartContainerRequest.class);
|
||||||
@ -259,6 +255,7 @@ public class TestContainerManager extends BaseContainerManagerTest {
|
|||||||
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
||||||
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
||||||
context.getNodeId().getHost() + ":12345");
|
context.getNodeId().getHost() + ":12345");
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER);
|
||||||
|
|
||||||
StartContainerRequest startRequest = recordFactory.newRecordInstance(StartContainerRequest.class);
|
StartContainerRequest startRequest = recordFactory.newRecordInstance(StartContainerRequest.class);
|
||||||
startRequest.setContainerLaunchContext(containerLaunchContext);
|
startRequest.setContainerLaunchContext(containerLaunchContext);
|
||||||
@ -370,6 +367,8 @@ public class TestContainerManager extends BaseContainerManagerTest {
|
|||||||
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
||||||
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
||||||
context.getNodeId().getHost() + ":12345");
|
context.getNodeId().getHost() + ":12345");
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER);
|
||||||
|
|
||||||
StartContainerRequest startRequest = recordFactory.newRecordInstance(StartContainerRequest.class);
|
StartContainerRequest startRequest = recordFactory.newRecordInstance(StartContainerRequest.class);
|
||||||
startRequest.setContainerLaunchContext(containerLaunchContext);
|
startRequest.setContainerLaunchContext(containerLaunchContext);
|
||||||
startRequest.setContainer(mockContainer);
|
startRequest.setContainer(mockContainer);
|
||||||
@ -470,6 +469,7 @@ public class TestContainerManager extends BaseContainerManagerTest {
|
|||||||
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
||||||
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
||||||
context.getNodeId().getHost() + ":12345");
|
context.getNodeId().getHost() + ":12345");
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER);
|
||||||
|
|
||||||
// containerLaunchContext.command = new ArrayList<CharSequence>();
|
// containerLaunchContext.command = new ArrayList<CharSequence>();
|
||||||
|
|
||||||
@ -541,19 +541,6 @@ public class TestContainerManager extends BaseContainerManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testContainerLaunchFromPreviousRM() throws IOException,
|
public void testContainerLaunchFromPreviousRM() throws IOException,
|
||||||
InterruptedException {
|
InterruptedException {
|
||||||
// There is no real RM registration, simulate and set RMIdentifier
|
|
||||||
NodeStatusUpdater nodeStatusUpdater = mock(NodeStatusUpdater.class);
|
|
||||||
when(nodeStatusUpdater.getRMIdentifier()).thenReturn((long) 1234);
|
|
||||||
containerManager =
|
|
||||||
new ContainerManagerImpl(context, exec, delSrvc, nodeStatusUpdater,
|
|
||||||
metrics, new ApplicationACLsManager(conf), dirsHandler) {
|
|
||||||
@Override
|
|
||||||
public void setBlockNewContainerRequests(
|
|
||||||
boolean blockNewContainerRequests) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
};
|
|
||||||
containerManager.init(conf);
|
|
||||||
containerManager.start();
|
containerManager.start();
|
||||||
|
|
||||||
ContainerLaunchContext containerLaunchContext =
|
ContainerLaunchContext containerLaunchContext =
|
||||||
@ -595,7 +582,8 @@ public class TestContainerManager extends BaseContainerManagerTest {
|
|||||||
// Construct the Container with a RMIdentifier within current RM
|
// Construct the Container with a RMIdentifier within current RM
|
||||||
Container mockContainer2 = mock(Container.class);
|
Container mockContainer2 = mock(Container.class);
|
||||||
when(mockContainer2.getId()).thenReturn(cId2);
|
when(mockContainer2.getId()).thenReturn(cId2);
|
||||||
when(mockContainer2.getRMIdentifer()).thenReturn((long) 1234);
|
when(mockContainer2.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER);
|
||||||
|
|
||||||
when(mockContainer2.getResource()).thenReturn(mockResource);
|
when(mockContainer2.getResource()).thenReturn(mockResource);
|
||||||
StartContainerRequest startRequest2 =
|
StartContainerRequest startRequest2 =
|
||||||
recordFactory.newRecordInstance(StartContainerRequest.class);
|
recordFactory.newRecordInstance(StartContainerRequest.class);
|
||||||
|
@ -180,6 +180,7 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
|
|||||||
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
||||||
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
||||||
context.getNodeId().getHost() + ":12345");
|
context.getNodeId().getHost() + ":12345");
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER);
|
||||||
|
|
||||||
Map<String, String> userSetEnv = new HashMap<String, String>();
|
Map<String, String> userSetEnv = new HashMap<String, String>();
|
||||||
userSetEnv.put(Environment.CONTAINER_ID.name(), "user_set_container_id");
|
userSetEnv.put(Environment.CONTAINER_ID.name(), "user_set_container_id");
|
||||||
@ -376,6 +377,7 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
|
|||||||
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
||||||
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
||||||
context.getNodeId().getHost() + ":12345");
|
context.getNodeId().getHost() + ":12345");
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER);
|
||||||
|
|
||||||
containerLaunchContext.setUser(user);
|
containerLaunchContext.setUser(user);
|
||||||
|
|
||||||
|
@ -691,6 +691,7 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
|
|||||||
ContainerId cId = BuilderUtils.newContainerId(appAttemptId, 0);
|
ContainerId cId = BuilderUtils.newContainerId(appAttemptId, 0);
|
||||||
|
|
||||||
when(mockContainer.getId()).thenReturn(cId);
|
when(mockContainer.getId()).thenReturn(cId);
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER);
|
||||||
|
|
||||||
containerLaunchContext.setUser(this.user);
|
containerLaunchContext.setUser(this.user);
|
||||||
|
|
||||||
|
@ -216,6 +216,8 @@ public class TestContainersMonitor extends BaseContainerManagerTest {
|
|||||||
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
when(mockContainer.getNodeId()).thenReturn(context.getNodeId());
|
||||||
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
when(mockContainer.getNodeHttpAddress()).thenReturn(
|
||||||
context.getNodeId().getHost() + ":12345");
|
context.getNodeId().getHost() + ":12345");
|
||||||
|
when(mockContainer.getRMIdentifer()).thenReturn(
|
||||||
|
super.DUMMY_RM_IDENTIFIER);
|
||||||
containerLaunchContext.setUser(user);
|
containerLaunchContext.setUser(user);
|
||||||
|
|
||||||
URL resource_alpha =
|
URL resource_alpha =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user