Search in sources :

Example 1 with ContainerRuntimeContext

use of org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerRuntimeContext in project hadoop by apache.

the class LinuxContainerExecutor method signalContainer.

@Override
public boolean signalContainer(ContainerSignalContext ctx) throws IOException {
    Container container = ctx.getContainer();
    String user = ctx.getUser();
    String pid = ctx.getPid();
    Signal signal = ctx.getSignal();
    verifyUsernamePattern(user);
    String runAsUser = getRunAsUser(user);
    ContainerRuntimeContext runtimeContext = new ContainerRuntimeContext.Builder(container).setExecutionAttribute(RUN_AS_USER, runAsUser).setExecutionAttribute(USER, user).setExecutionAttribute(PID, pid).setExecutionAttribute(SIGNAL, signal).build();
    try {
        linuxContainerRuntime.signalContainer(runtimeContext);
    } catch (ContainerExecutionException e) {
        int retCode = e.getExitCode();
        if (retCode == PrivilegedOperation.ResultCode.INVALID_CONTAINER_PID.getValue()) {
            return false;
        }
        LOG.warn("Error in signalling container " + pid + " with " + signal + "; exit = " + retCode, e);
        logOutput(e.getOutput());
        throw new IOException("Problem signalling container " + pid + " with " + signal + "; output: " + e.getOutput() + " and exitCode: " + retCode, e);
    }
    return true;
}
Also used : Container(org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container) ContainerExecutionException(org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerExecutionException) IOException(java.io.IOException) ContainerRuntimeContext(org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerRuntimeContext)

Aggregations

IOException (java.io.IOException)1 Container (org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container)1 ContainerExecutionException (org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerExecutionException)1 ContainerRuntimeContext (org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerRuntimeContext)1