Description
@Override public void transition(ContainerImpl container, ContainerEvent event) { container.setIsReInitializing(false); // Set exit code to 0 on success container.exitCode = 0; // TODO: Add containerWorkDir to the deletion service. if (DockerLinuxContainerRuntime.isDockerContainerRequested( container.daemonConf, container.getLaunchContext().getEnvironment())) { removeDockerContainer(container); } if (clCleanupRequired) { container.dispatcher.getEventHandler().handle( new ContainersLauncherEvent(container, ContainersLauncherEventType.CLEANUP_CONTAINER)); } container.cleanup(); }
Now, when container is finished, NM firstly execute "docker rm xxx" to remove it and this thread is placed in DeletionService. see more in YARN-5366 .
Next, NM will execute "docker stop" and "docker kill" command. these tow commands are wrapped up in ContainerCleanup thread and executed by ContainersLauncher. see more in YARN-7644.
The above will cause the container's cleanup to be split into two threads. I think we should refactor these code to make all docker container killing process be place in ContainerCleanup thread and "docker rm" should be executed last.