xintongsong commented on a change in pull request #11248: [FLINK-16299] Release
containers recovered from previous attempt in w…
URL: https://github.com/apache/flink/pull/11248#discussion_r386173738
##########
File path:
flink-yarn/src/test/java/org/apache/flink/yarn/YarnResourceManagerTest.java
##########
@@ -528,6 +553,40 @@ public void testOnStartContainerError() throws Exception {
}};
}
+ @Test
+ public void testHandleContainersFromPreviousAttempt() throws Exception {
+ new Context() {{
+ runTest(() -> {
+ Container runningCountainer =
mockContainer("container", 1234, 1, resourceManager.getContainerResource());
+ Container newContainer =
mockContainer("container", 1234, 2, resourceManager.getContainerResource());
+
+
resourceManager.getTestingNMClientAsync().setGetContainerStatusAsyncBiFunction((containerId,
nodeId) -> {
+ if
(containerId.equals(runningCountainer.getId())) {
+ return
ContainerStatus.newInstance(containerId, ContainerState.RUNNING, "", 0);
+ } else {
+ return
ContainerStatus.newInstance(containerId, ContainerState.NEW, "", 0);
+ }
+ });
+
+ List<Container> containersFromPreviousAttempt =
new ArrayList<>();
+ containersFromPreviousAttempt.add(newContainer);
+
containersFromPreviousAttempt.add(runningCountainer);
+ RegisterApplicationMasterResponse testResponse
= RegisterApplicationMasterResponse.newInstance(
+ resourceManager.getContainerResource(),
+ resourceManager.getContainerResource(),
+ Collections.emptyMap(),
+ null,
+ containersFromPreviousAttempt,
+ "",
+ Collections.emptyList());
+
resourceManager.getContainersFromPreviousAttempts(testResponse);
+
+
verify(mockResourceManagerClient).releaseAssignedContainer(newContainer.getId());
+ assertEquals(1,
resourceManager.getWorkerNodeMap().size());
Review comment:
In addition to the size, we can also verify the worker in the worker not map
is the running container.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services