YARN-7973. Added ContainerRelaunch feature for Docker containers.
Addendum patch 001 Contributed by Shane Kumpf
This commit is contained in:
parent
f729fb0baa
commit
cf46533bca
|
@ -924,17 +924,17 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime {
|
||||||
@Override
|
@Override
|
||||||
public void relaunchContainer(ContainerRuntimeContext ctx)
|
public void relaunchContainer(ContainerRuntimeContext ctx)
|
||||||
throws ContainerExecutionException {
|
throws ContainerExecutionException {
|
||||||
Container container = ctx.getContainer();
|
ContainerId containerId = ctx.getContainer().getContainerId();
|
||||||
String containerIdStr = container.getContainerId().toString();
|
String containerIdStr = containerId.toString();
|
||||||
// Check to see if the container already exists for relaunch
|
// Check to see if the container already exists for relaunch
|
||||||
DockerCommandExecutor.DockerContainerStatus containerStatus =
|
DockerCommandExecutor.DockerContainerStatus containerStatus =
|
||||||
DockerCommandExecutor.getContainerStatus(containerIdStr, conf,
|
DockerCommandExecutor.getContainerStatus(containerIdStr, conf,
|
||||||
privilegedOperationExecutor);
|
privilegedOperationExecutor, nmContext);
|
||||||
if (containerStatus != null &&
|
if (containerStatus != null &&
|
||||||
DockerCommandExecutor.isStartable(containerStatus)) {
|
DockerCommandExecutor.isStartable(containerStatus)) {
|
||||||
DockerStartCommand startCommand = new DockerStartCommand(containerIdStr);
|
DockerStartCommand startCommand = new DockerStartCommand(containerIdStr);
|
||||||
String commandFile = dockerClient.writeCommandToTempFile(startCommand,
|
String commandFile = dockerClient.writeCommandToTempFile(startCommand,
|
||||||
containerIdStr);
|
containerId, nmContext);
|
||||||
PrivilegedOperation launchOp = buildLaunchOp(ctx, commandFile,
|
PrivilegedOperation launchOp = buildLaunchOp(ctx, commandFile,
|
||||||
startCommand);
|
startCommand);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue