YARN-8465. Fixed docker container status for node manager restart.
Contributed by Shane Kumpf
This commit is contained in:
parent
2ce892fcf5
commit
0aa7272199
|
@ -1031,7 +1031,6 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime {
|
|||
handleContainerKill(ctx, env, signal);
|
||||
}
|
||||
} catch (ContainerExecutionException e) {
|
||||
LOG.warn("Signal docker container failed. Exception: ", e);
|
||||
throw new ContainerExecutionException("Signal docker container failed",
|
||||
e.getExitCode(), e.getOutput(), e.getErrorOutput());
|
||||
}
|
||||
|
@ -1205,7 +1204,8 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime {
|
|||
if (!new File(procFs + File.separator + pid).exists()) {
|
||||
String msg = "Liveliness check failed for PID: " + pid
|
||||
+ ". Container may have already completed.";
|
||||
throw new ContainerExecutionException(msg);
|
||||
throw new ContainerExecutionException(msg,
|
||||
PrivilegedOperation.ResultCode.INVALID_CONTAINER_PID.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,12 @@ public class ContainerExecutionException extends YarnException {
|
|||
errorOutput = OUTPUT_UNSET;
|
||||
}
|
||||
|
||||
public ContainerExecutionException(String message, int exitCode) {
|
||||
super(message);
|
||||
this.exitCode = exitCode;
|
||||
this.output = OUTPUT_UNSET;
|
||||
this.errorOutput = OUTPUT_UNSET;
|
||||
}
|
||||
|
||||
public ContainerExecutionException(String message, int exitCode, String
|
||||
output, String errorOutput) {
|
||||
|
|
|
@ -1487,7 +1487,7 @@ public class TestDockerContainerRuntime {
|
|||
runtime.signalContainer(builder.build());
|
||||
}
|
||||
|
||||
@Test(expected = ContainerExecutionException.class)
|
||||
@Test
|
||||
public void testContainerLivelinessNoFileException() throws Exception {
|
||||
DockerLinuxContainerRuntime runtime = new DockerLinuxContainerRuntime(
|
||||
mockExecutor, mockCGroupsHandler);
|
||||
|
@ -1496,7 +1496,13 @@ public class TestDockerContainerRuntime {
|
|||
.setExecutionAttribute(PID, signalPid)
|
||||
.setExecutionAttribute(SIGNAL, ContainerExecutor.Signal.NULL);
|
||||
runtime.initialize(enableMockContainerExecutor(conf), null);
|
||||
runtime.signalContainer(builder.build());
|
||||
try {
|
||||
runtime.signalContainer(builder.build());
|
||||
} catch (ContainerExecutionException e) {
|
||||
Assert.assertEquals(
|
||||
PrivilegedOperation.ResultCode.INVALID_CONTAINER_PID.getValue(),
|
||||
e.getExitCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue