Skip to content

Commit 5648501

Browse files
authored
Revert "YARN-11709. NodeManager should be shut down or blacklisted when it ca…"
This reverts commit f000942.
1 parent 57e62ae commit 5648501

File tree

2 files changed

+5
-36
lines changed

2 files changed

+5
-36
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,8 @@ public void startLocalizer(LocalizerStartContext ctx)
451451

452452
} catch (PrivilegedOperationException e) {
453453
int exitCode = e.getExitCode();
454-
LOG.error("Unrecoverable issue occurred. Marking the node as unhealthy to prevent "
455-
+ "further containers to get scheduled on the node and cause application failures. " +
456-
"Exit code from the container " + locId + "startLocalizer is : " + exitCode, e);
457-
nmContext.getNodeStatusUpdater().reportException(e);
454+
LOG.warn("Exit code from container {} startLocalizer is : {}",
455+
locId, exitCode, e);
458456

459457
throw new IOException("Application " + appId + " initialization failed" +
460458
" (exitCode=" + exitCode + ") with output: " + e.getOutput(), e);

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestLinuxContainerExecutorWithMocks.java

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import static org.mockito.ArgumentMatchers.any;
2727
import static org.mockito.ArgumentMatchers.anyBoolean;
2828
import static org.mockito.Mockito.doAnswer;
29-
import static org.mockito.Mockito.doNothing;
3029
import static org.mockito.Mockito.doThrow;
3130
import static org.mockito.Mockito.mock;
3231
import static org.mockito.Mockito.spy;
@@ -38,7 +37,6 @@
3837
import java.io.FileReader;
3938
import java.io.IOException;
4039
import java.io.LineNumberReader;
41-
import java.lang.reflect.Field;
4240
import java.net.InetSocketAddress;
4341
import java.net.URI;
4442
import java.net.URISyntaxException;
@@ -347,8 +345,7 @@ public void testStartLocalizer() throws IOException {
347345

348346
@Test
349347
public void testContainerLaunchError()
350-
throws IOException, ContainerExecutionException, URISyntaxException, IllegalAccessException,
351-
NoSuchFieldException {
348+
throws IOException, ContainerExecutionException, URISyntaxException {
352349

353350
final String[] expecetedMessage = {"badcommand", "Exit code: 24"};
354351
final String[] executor = {
@@ -390,14 +387,6 @@ public Object answer(InvocationOnMock invocationOnMock)
390387
dirsHandler.init(conf);
391388
mockExec.setConf(conf);
392389

393-
//set the private nmContext field without initing the LinuxContainerExecutor
394-
NodeManager nodeManager = new NodeManager();
395-
NodeManager.NMContext nmContext =
396-
nodeManager.createNMContext(null, null, null, false, conf);
397-
Field lceNmContext = LinuxContainerExecutor.class.getDeclaredField("nmContext");
398-
lceNmContext.setAccessible(true);
399-
lceNmContext.set(mockExec, nmContext);
400-
401390
String appSubmitter = "nobody";
402391
String cmd = String
403392
.valueOf(PrivilegedOperation.RunAsUserCommand.LAUNCH_CONTAINER.
@@ -612,30 +601,15 @@ public void testNoExitCodeFromPrivilegedOperation() throws Exception {
612601
LinuxContainerRuntime runtime = new DefaultLinuxContainerRuntime(
613602
spyPrivilegedExecutor);
614603
runtime.initialize(conf, null);
604+
mockExec = new LinuxContainerExecutor(runtime);
605+
mockExec.setConf(conf);
615606
LinuxContainerExecutor lce = new LinuxContainerExecutor(runtime) {
616607
@Override
617608
protected PrivilegedOperationExecutor getPrivilegedOperationExecutor() {
618609
return spyPrivilegedExecutor;
619610
}
620611
};
621612
lce.setConf(conf);
622-
623-
//set the private nmContext field without initing the LinuxContainerExecutor
624-
NodeManager nodeManager = new NodeManager();
625-
NodeManager.NMContext nmContext =
626-
nodeManager.createNMContext(null, null, null, false, conf);
627-
NodeManager.NMContext spyNmContext = spy(nmContext);
628-
629-
//initialize a mock NodeStatusUpdater
630-
NodeStatusUpdaterImpl nodeStatusUpdater = mock(NodeStatusUpdaterImpl.class);
631-
nmContext.setNodeStatusUpdater(nodeStatusUpdater);
632-
//imitate a void method call on the NodeStatusUpdater when setting NM unhealthy.
633-
doNothing().when(nodeStatusUpdater).reportException(any());
634-
635-
Field lceNmContext = LinuxContainerExecutor.class.getDeclaredField("nmContext");
636-
lceNmContext.setAccessible(true);
637-
lceNmContext.set(lce, nmContext);
638-
639613
InetSocketAddress address = InetSocketAddress.createUnresolved(
640614
"localhost", 8040);
641615
Path nmPrivateCTokensPath= new Path("file:///bin/nmPrivateCTokensPath");
@@ -698,9 +672,6 @@ protected PrivilegedOperationExecutor getPrivilegedOperationExecutor() {
698672
assertTrue("Unexpected exception " + e,
699673
e.getMessage().contains("exit code"));
700674
}
701-
702-
//verify that the NM was set unhealthy on PrivilegedOperationException
703-
verify(nodeStatusUpdater, times(1)).reportException(any());
704675
}
705676

706677
@Test

0 commit comments

Comments
 (0)