YARN-8035. Uncaught exception in ContainersMonitorImpl during relaunch due to the process ID changing. Contributed by Shane Kumpf.
This commit is contained in:
parent
5a174f8ac6
commit
2d06d885c8
|
@ -274,7 +274,7 @@ public class ContainerMetrics implements MetricsSource {
|
|||
}
|
||||
|
||||
public void recordProcessId(String processId) {
|
||||
registry.tag(PROCESSID_INFO, processId);
|
||||
registry.tag(PROCESSID_INFO, processId, true);
|
||||
}
|
||||
|
||||
public void recordResourceLimit(int vmemLimit, int pmemLimit, int cpuVcores) {
|
||||
|
|
|
@ -206,4 +206,21 @@ public class TestContainerMetrics {
|
|||
}
|
||||
Assert.assertEquals(expectedValues.keySet(), testResults);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContainerMetricsUpdateContainerPid() {
|
||||
ContainerId containerId = mock(ContainerId.class);
|
||||
ContainerMetrics metrics = ContainerMetrics.forContainer(containerId,
|
||||
100, 1);
|
||||
|
||||
String origPid = "1234";
|
||||
metrics.recordProcessId(origPid);
|
||||
assertEquals(origPid, metrics.registry.getTag(
|
||||
ContainerMetrics.PROCESSID_INFO.name()).value());
|
||||
|
||||
String newPid = "4321";
|
||||
metrics.recordProcessId(newPid);
|
||||
assertEquals(newPid, metrics.registry.getTag(
|
||||
ContainerMetrics.PROCESSID_INFO.name()).value());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue