Search in sources :

Example 6 with WeaveContainerController

use of com.continuuity.weave.internal.WeaveContainerController in project weave by continuuity.

the class RunningContainers method start.

void start(String runnableName, ContainerInfo containerInfo, WeaveContainerLauncher launcher) {
    containerLock.lock();
    try {
        int instanceId = getStartInstanceId(runnableName);
        RunId runId = getRunId(runnableName, instanceId);
        WeaveContainerController controller = launcher.start(runId, instanceId, WeaveContainerMain.class, "$HADOOP_CONF_DIR");
        containers.put(runnableName, containerInfo.getId(), controller);
        WeaveRunResources resources = new DefaultWeaveRunResources(instanceId, containerInfo.getId(), containerInfo.getVirtualCores(), containerInfo.getMemoryMB(), containerInfo.getHost().getHostName());
        resourceReport.addRunResources(runnableName, resources);
        if (startSequence.isEmpty() || !runnableName.equals(startSequence.peekLast())) {
            startSequence.addLast(runnableName);
        }
        containerChange.signalAll();
    } finally {
        containerLock.unlock();
    }
}
Also used : DefaultWeaveRunResources(com.continuuity.weave.internal.DefaultWeaveRunResources) WeaveContainerController(com.continuuity.weave.internal.WeaveContainerController) RunId(com.continuuity.weave.api.RunId) WeaveRunResources(com.continuuity.weave.api.WeaveRunResources) DefaultWeaveRunResources(com.continuuity.weave.internal.DefaultWeaveRunResources)

Aggregations

WeaveContainerController (com.continuuity.weave.internal.WeaveContainerController)6 RunId (com.continuuity.weave.api.RunId)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Map (java.util.Map)2 ServiceController (com.continuuity.weave.api.ServiceController)1 WeaveRunResources (com.continuuity.weave.api.WeaveRunResources)1 DefaultWeaveRunResources (com.continuuity.weave.internal.DefaultWeaveRunResources)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ContainerState (org.apache.hadoop.yarn.api.records.ContainerState)1