Revert "YARN-11709. NodeManager should be shut down or blacklisted when it ca…" (#7028)
Some checks failed
website / build (push) Has been cancelled

This reverts commit f00094203b.
This commit is contained in:
Benjamin Teke 2024-09-07 08:48:38 +02:00 committed by GitHub
parent a00b1c06f3
commit 8c41fbcaf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 36 deletions

View File

@ -451,10 +451,8 @@ public void startLocalizer(LocalizerStartContext ctx)
} catch (PrivilegedOperationException e) { } catch (PrivilegedOperationException e) {
int exitCode = e.getExitCode(); int exitCode = e.getExitCode();
LOG.error("Unrecoverable issue occurred. Marking the node as unhealthy to prevent " LOG.warn("Exit code from container {} startLocalizer is : {}",
+ "further containers to get scheduled on the node and cause application failures. " + locId, exitCode, e);
"Exit code from the container " + locId + "startLocalizer is : " + exitCode, e);
nmContext.getNodeStatusUpdater().reportException(e);
throw new IOException("Application " + appId + " initialization failed" + throw new IOException("Application " + appId + " initialization failed" +
" (exitCode=" + exitCode + ") with output: " + e.getOutput(), e); " (exitCode=" + exitCode + ") with output: " + e.getOutput(), e);

View File

@ -26,7 +26,6 @@
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
@ -38,7 +37,6 @@
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.LineNumberReader; import java.io.LineNumberReader;
import java.lang.reflect.Field;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -347,8 +345,7 @@ public void testStartLocalizer() throws IOException {
@Test @Test
public void testContainerLaunchError() public void testContainerLaunchError()
throws IOException, ContainerExecutionException, URISyntaxException, IllegalAccessException, throws IOException, ContainerExecutionException, URISyntaxException {
NoSuchFieldException {
final String[] expecetedMessage = {"badcommand", "Exit code: 24"}; final String[] expecetedMessage = {"badcommand", "Exit code: 24"};
final String[] executor = { final String[] executor = {
@ -390,14 +387,6 @@ public Object answer(InvocationOnMock invocationOnMock)
dirsHandler.init(conf); dirsHandler.init(conf);
mockExec.setConf(conf); mockExec.setConf(conf);
//set the private nmContext field without initing the LinuxContainerExecutor
NodeManager nodeManager = new NodeManager();
NodeManager.NMContext nmContext =
nodeManager.createNMContext(null, null, null, false, conf);
Field lceNmContext = LinuxContainerExecutor.class.getDeclaredField("nmContext");
lceNmContext.setAccessible(true);
lceNmContext.set(mockExec, nmContext);
String appSubmitter = "nobody"; String appSubmitter = "nobody";
String cmd = String String cmd = String
.valueOf(PrivilegedOperation.RunAsUserCommand.LAUNCH_CONTAINER. .valueOf(PrivilegedOperation.RunAsUserCommand.LAUNCH_CONTAINER.
@ -612,6 +601,8 @@ public void testNoExitCodeFromPrivilegedOperation() throws Exception {
LinuxContainerRuntime runtime = new DefaultLinuxContainerRuntime( LinuxContainerRuntime runtime = new DefaultLinuxContainerRuntime(
spyPrivilegedExecutor); spyPrivilegedExecutor);
runtime.initialize(conf, null); runtime.initialize(conf, null);
mockExec = new LinuxContainerExecutor(runtime);
mockExec.setConf(conf);
LinuxContainerExecutor lce = new LinuxContainerExecutor(runtime) { LinuxContainerExecutor lce = new LinuxContainerExecutor(runtime) {
@Override @Override
protected PrivilegedOperationExecutor getPrivilegedOperationExecutor() { protected PrivilegedOperationExecutor getPrivilegedOperationExecutor() {
@ -619,23 +610,6 @@ protected PrivilegedOperationExecutor getPrivilegedOperationExecutor() {
} }
}; };
lce.setConf(conf); lce.setConf(conf);
//set the private nmContext field without initing the LinuxContainerExecutor
NodeManager nodeManager = new NodeManager();
NodeManager.NMContext nmContext =
nodeManager.createNMContext(null, null, null, false, conf);
NodeManager.NMContext spyNmContext = spy(nmContext);
//initialize a mock NodeStatusUpdater
NodeStatusUpdaterImpl nodeStatusUpdater = mock(NodeStatusUpdaterImpl.class);
nmContext.setNodeStatusUpdater(nodeStatusUpdater);
//imitate a void method call on the NodeStatusUpdater when setting NM unhealthy.
doNothing().when(nodeStatusUpdater).reportException(any());
Field lceNmContext = LinuxContainerExecutor.class.getDeclaredField("nmContext");
lceNmContext.setAccessible(true);
lceNmContext.set(lce, nmContext);
InetSocketAddress address = InetSocketAddress.createUnresolved( InetSocketAddress address = InetSocketAddress.createUnresolved(
"localhost", 8040); "localhost", 8040);
Path nmPrivateCTokensPath= new Path("file:///bin/nmPrivateCTokensPath"); Path nmPrivateCTokensPath= new Path("file:///bin/nmPrivateCTokensPath");
@ -698,9 +672,6 @@ protected PrivilegedOperationExecutor getPrivilegedOperationExecutor() {
assertTrue("Unexpected exception " + e, assertTrue("Unexpected exception " + e,
e.getMessage().contains("exit code")); e.getMessage().contains("exit code"));
} }
//verify that the NM was set unhealthy on PrivilegedOperationException
verify(nodeStatusUpdater, times(1)).reportException(any());
} }
@Test @Test