YARN-1697. NodeManager reports negative running containers (Sandy Ryza)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1567381 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7ef269e9a4
commit
5bc592d88d
|
@ -217,6 +217,8 @@ Release 2.4.0 - UNRELEASED
|
||||||
YARN-1698. Fixed default TimelineStore in code to match what is documented
|
YARN-1698. Fixed default TimelineStore in code to match what is documented
|
||||||
in yarn-default.xml (Zhijie Shen via vinodkv)
|
in yarn-default.xml (Zhijie Shen via vinodkv)
|
||||||
|
|
||||||
|
YARN=1697. NodeManager reports negative running containers (Sandy Ryza)
|
||||||
|
|
||||||
Release 2.3.1 - UNRELEASED
|
Release 2.3.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -83,6 +83,7 @@ public class ContainerImpl implements Container {
|
||||||
private final String user;
|
private final String user;
|
||||||
private int exitCode = ContainerExitStatus.INVALID;
|
private int exitCode = ContainerExitStatus.INVALID;
|
||||||
private final StringBuilder diagnostics;
|
private final StringBuilder diagnostics;
|
||||||
|
private boolean wasLaunched;
|
||||||
|
|
||||||
/** The NM-wide configuration - not specific to this container */
|
/** The NM-wide configuration - not specific to this container */
|
||||||
private final Configuration daemonConf;
|
private final Configuration daemonConf;
|
||||||
|
@ -418,7 +419,9 @@ public class ContainerImpl implements Container {
|
||||||
applicationId, containerId);
|
applicationId, containerId);
|
||||||
break;
|
break;
|
||||||
case EXITED_WITH_FAILURE:
|
case EXITED_WITH_FAILURE:
|
||||||
|
if (wasLaunched) {
|
||||||
metrics.endRunningContainer();
|
metrics.endRunningContainer();
|
||||||
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case LOCALIZATION_FAILED:
|
case LOCALIZATION_FAILED:
|
||||||
metrics.failedContainer();
|
metrics.failedContainer();
|
||||||
|
@ -428,7 +431,9 @@ public class ContainerImpl implements Container {
|
||||||
applicationId, containerId);
|
applicationId, containerId);
|
||||||
break;
|
break;
|
||||||
case CONTAINER_CLEANEDUP_AFTER_KILL:
|
case CONTAINER_CLEANEDUP_AFTER_KILL:
|
||||||
|
if (wasLaunched) {
|
||||||
metrics.endRunningContainer();
|
metrics.endRunningContainer();
|
||||||
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case NEW:
|
case NEW:
|
||||||
metrics.killedContainer();
|
metrics.killedContainer();
|
||||||
|
@ -636,6 +641,7 @@ public class ContainerImpl implements Container {
|
||||||
new ContainerStartMonitoringEvent(container.containerId,
|
new ContainerStartMonitoringEvent(container.containerId,
|
||||||
vmemBytes, pmemBytes));
|
vmemBytes, pmemBytes));
|
||||||
container.metrics.runningContainer();
|
container.metrics.runningContainer();
|
||||||
|
container.wasLaunched = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,4 +99,8 @@ public class NodeManagerMetrics {
|
||||||
public void addResource(Resource res) {
|
public void addResource(Resource res) {
|
||||||
availableGB.incr(res.getMemory() / 1024);
|
availableGB.incr(res.getMemory() / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRunningContainers() {
|
||||||
|
return containersRunning.value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,6 +348,9 @@ public class TestContainer {
|
||||||
wc.c.getContainerState());
|
wc.c.getContainerState());
|
||||||
assertNull(wc.c.getLocalizedResources());
|
assertNull(wc.c.getLocalizedResources());
|
||||||
verifyCleanupCall(wc);
|
verifyCleanupCall(wc);
|
||||||
|
wc.c.handle(new ContainerEvent(wc.c.getContainerId(),
|
||||||
|
ContainerEventType.CONTAINER_RESOURCES_CLEANEDUP));
|
||||||
|
assertEquals(0, metrics.getRunningContainers());
|
||||||
} finally {
|
} finally {
|
||||||
if (wc != null) {
|
if (wc != null) {
|
||||||
wc.finished();
|
wc.finished();
|
||||||
|
|
Loading…
Reference in New Issue