Search in sources :

Example 1 with ContainerManager

use of org.apache.hadoop.yarn.api.ContainerManager in project weave by continuuity.

the class Hadoop20YarnNMClient method start.

@Override
public Cancellable start(YarnContainerInfo containerInfo, YarnLaunchContext launchContext) {
    ContainerLaunchContext context = launchContext.getLaunchContext();
    context.setUser(System.getProperty("user.name"));
    Container container = containerInfo.getContainer();
    context.setContainerId(container.getId());
    context.setResource(container.getResource());
    StartContainerRequest startRequest = Records.newRecord(StartContainerRequest.class);
    startRequest.setContainerLaunchContext(context);
    ContainerManager manager = connectContainerManager(container);
    try {
        manager.startContainer(startRequest);
        return new ContainerTerminator(container, manager);
    } catch (YarnRemoteException e) {
        LOG.error("Error in launching process", e);
        throw Throwables.propagate(e);
    }
}
Also used : Container(org.apache.hadoop.yarn.api.records.Container) ContainerManager(org.apache.hadoop.yarn.api.ContainerManager) ContainerLaunchContext(org.apache.hadoop.yarn.api.records.ContainerLaunchContext) StartContainerRequest(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest) YarnRemoteException(org.apache.hadoop.yarn.exceptions.YarnRemoteException)

Aggregations

ContainerManager (org.apache.hadoop.yarn.api.ContainerManager)1 StartContainerRequest (org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)1 Container (org.apache.hadoop.yarn.api.records.Container)1 ContainerLaunchContext (org.apache.hadoop.yarn.api.records.ContainerLaunchContext)1 YarnRemoteException (org.apache.hadoop.yarn.exceptions.YarnRemoteException)1