YARN-1053. Diagnostic message from ContainerExitEvent is ignored in ContainerImpl (Omkar Vinit Joshi via bikas)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1543973 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3cae2ba63f
commit
d1fe9e4142
|
@ -164,6 +164,9 @@ Release 2.3.0 - UNRELEASED
|
||||||
current attempt instead of the attempt passed as argument (Omkar Vinit
|
current attempt instead of the attempt passed as argument (Omkar Vinit
|
||||||
Joshi via bikas)
|
Joshi via bikas)
|
||||||
|
|
||||||
|
YARN-1053. Diagnostic message from ContainerExitEvent is ignored in
|
||||||
|
ContainerImpl (Omkar Vinit Joshi via bikas)
|
||||||
|
|
||||||
Release 2.2.1 - UNRELEASED
|
Release 2.2.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.server.nodemanager.containermanager.container;
|
package org.apache.hadoop.yarn.server.nodemanager.containermanager.container;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -687,6 +686,10 @@ public class ContainerImpl implements Container {
|
||||||
public void transition(ContainerImpl container, ContainerEvent event) {
|
public void transition(ContainerImpl container, ContainerEvent event) {
|
||||||
ContainerExitEvent exitEvent = (ContainerExitEvent) event;
|
ContainerExitEvent exitEvent = (ContainerExitEvent) event;
|
||||||
container.exitCode = exitEvent.getExitCode();
|
container.exitCode = exitEvent.getExitCode();
|
||||||
|
if (exitEvent.getDiagnosticInfo() != null) {
|
||||||
|
container.diagnostics.append(exitEvent.getDiagnosticInfo())
|
||||||
|
.append('\n');
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Add containerWorkDir to the deletion service.
|
// TODO: Add containerWorkDir to the deletion service.
|
||||||
// TODO: Add containerOuputDir to the deletion service.
|
// TODO: Add containerOuputDir to the deletion service.
|
||||||
|
@ -806,6 +809,10 @@ public class ContainerImpl implements Container {
|
||||||
public void transition(ContainerImpl container, ContainerEvent event) {
|
public void transition(ContainerImpl container, ContainerEvent event) {
|
||||||
ContainerExitEvent exitEvent = (ContainerExitEvent) event;
|
ContainerExitEvent exitEvent = (ContainerExitEvent) event;
|
||||||
container.exitCode = exitEvent.getExitCode();
|
container.exitCode = exitEvent.getExitCode();
|
||||||
|
if (exitEvent.getDiagnosticInfo() != null) {
|
||||||
|
container.diagnostics.append(exitEvent.getDiagnosticInfo())
|
||||||
|
.append('\n');
|
||||||
|
}
|
||||||
|
|
||||||
// The process/process-grp is killed. Decrement reference counts and
|
// The process/process-grp is killed. Decrement reference counts and
|
||||||
// cleanup resources
|
// cleanup resources
|
||||||
|
|
|
@ -55,6 +55,7 @@ import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
|
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ContainerStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.LocalResource;
|
import org.apache.hadoop.yarn.api.records.LocalResource;
|
||||||
import org.apache.hadoop.yarn.api.records.LocalResourceType;
|
import org.apache.hadoop.yarn.api.records.LocalResourceType;
|
||||||
import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
|
import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
|
||||||
|
@ -844,9 +845,13 @@ public class TestContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void containerFailed(int exitCode) {
|
public void containerFailed(int exitCode) {
|
||||||
|
String diagnosticMsg = "Container completed with exit code " + exitCode;
|
||||||
c.handle(new ContainerExitEvent(cId,
|
c.handle(new ContainerExitEvent(cId,
|
||||||
ContainerEventType.CONTAINER_EXITED_WITH_FAILURE, exitCode,
|
ContainerEventType.CONTAINER_EXITED_WITH_FAILURE, exitCode,
|
||||||
"Container completed with exit code " + exitCode));
|
diagnosticMsg));
|
||||||
|
ContainerStatus containerStatus = c.cloneAndGetContainerStatus();
|
||||||
|
assert containerStatus.getDiagnostics().contains(diagnosticMsg);
|
||||||
|
assert containerStatus.getExitStatus() == exitCode;
|
||||||
drainDispatcherEvents();
|
drainDispatcherEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,9 +862,13 @@ public class TestContainer {
|
||||||
|
|
||||||
public void containerKilledOnRequest() {
|
public void containerKilledOnRequest() {
|
||||||
int exitCode = ExitCode.FORCE_KILLED.getExitCode();
|
int exitCode = ExitCode.FORCE_KILLED.getExitCode();
|
||||||
|
String diagnosticMsg = "Container completed with exit code " + exitCode;
|
||||||
c.handle(new ContainerExitEvent(cId,
|
c.handle(new ContainerExitEvent(cId,
|
||||||
ContainerEventType.CONTAINER_KILLED_ON_REQUEST, exitCode,
|
ContainerEventType.CONTAINER_KILLED_ON_REQUEST, exitCode,
|
||||||
"Container completed with exit code " + exitCode));
|
diagnosticMsg));
|
||||||
|
ContainerStatus containerStatus = c.cloneAndGetContainerStatus();
|
||||||
|
assert containerStatus.getDiagnostics().contains(diagnosticMsg);
|
||||||
|
assert containerStatus.getExitStatus() == exitCode;
|
||||||
drainDispatcherEvents();
|
drainDispatcherEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue