Example usage for org.apache.hadoop.yarn.api.records.impl.pb ContainerPBImpl ContainerPBImpl

List of usage examples for org.apache.hadoop.yarn.api.records.impl.pb ContainerPBImpl ContainerPBImpl

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records.impl.pb ContainerPBImpl ContainerPBImpl.

Prototype

public ContainerPBImpl() 

Source Link

Usage

From source file:org.apache.hoya.yarn.appmaster.state.AppState.java

License:Apache License

/**
 * build up the special master node, which lives
 * in the live node set but has a lifecycle bonded to the AM
 * @param containerId the AM master//from  www  .  j  a v a2s . c  o  m
 * @param host
 * @param nodeHttpAddress
 */
public void buildAppMasterNode(ContainerId containerId, String host, int amPort, String nodeHttpAddress) {
    Container container = new ContainerPBImpl();
    container.setId(containerId);
    NodeId nodeId = NodeId.newInstance(host, amPort);
    container.setNodeId(nodeId);
    container.setNodeHttpAddress(nodeHttpAddress);
    RoleInstance am = new RoleInstance(container);
    am.role = HoyaKeys.COMPONENT_AM;
    appMasterNode = am;
    //it is also added to the set of live nodes
    getLiveNodes().put(containerId, am);
}

From source file:org.apache.slider.server.appmaster.state.AppState.java

License:Apache License

/**
 * build up the special master node, which lives
 * in the live node set but has a lifecycle bonded to the AM
 * @param containerId the AM master//from w w  w .jav a 2  s.co  m
 * @param host hostname
 * @param amPort port
 * @param nodeHttpAddress http address: may be null
 */
public void buildAppMasterNode(ContainerId containerId, String host, int amPort, String nodeHttpAddress) {
    Container container = new ContainerPBImpl();
    container.setId(containerId);
    NodeId nodeId = NodeId.newInstance(host, amPort);
    container.setNodeId(nodeId);
    container.setNodeHttpAddress(nodeHttpAddress);
    RoleInstance am = new RoleInstance(container);
    am.role = SliderKeys.COMPONENT_AM;
    appMasterNode = am;
    //it is also added to the set of live nodes
    getLiveNodes().put(containerId, am);

    // patch up the role status
    RoleStatus roleStatus = roleStatusMap.get((SliderKeys.ROLE_AM_PRIORITY_INDEX));
    roleStatus.setDesired(1);
    roleStatus.incActual();
    roleStatus.incStarted();
}

From source file:oz.hadoop.yarn.api.core.ApplicationContainerLauncherEmulatorImpl.java

License:Apache License

/**
 * /*  w w  w .  j av  a  2  s  .c  o  m*/
 * @param applicationSpecification
 * @param containerSpecification
 */
public ApplicationContainerLauncherEmulatorImpl(PrimitiveImmutableTypeMap applicationSpecification,
        PrimitiveImmutableTypeMap containerSpecification) {
    super(applicationSpecification, containerSpecification);
    this.executor = Executors.newCachedThreadPool();
    this.rmCallbackHandler = this.callbackSupport.buildResourceManagerCallbackHandler(this);
    this.nmCallbackHandler = this.callbackSupport.buildNodeManagerCallbackHandler(this);
    this.applicationId = ApplicationId.newInstance(System.currentTimeMillis(), 1);
    this.applicationAttemptId = ApplicationAttemptId.newInstance(this.applicationId, 1);
    this.applicationContainers = new HashMap<Container, ApplicationContainer>();

    // do preallocation early. Important for testing (see ApplicationContainerTests.validateSelfShutdownWithContainerStartupException)
    int containerStartId = 2;
    for (int i = 0; i < this.containerCount; i++) {
        ContainerRequest containerRequest = this.createConatinerRequest();
        // TODO implement a better mock so it can show ContainerRequest values
        Container container = new ContainerPBImpl();
        ContainerId containerId = ContainerId.newInstance(this.applicationAttemptId, containerStartId++);
        container.setId(containerId);
        ApplicationContainer applicationContainer = new ApplicationContainer(
                ApplicationContainerLauncherEmulatorImpl.this.applicationSpecification);
        this.applicationContainers.put(container, applicationContainer);
    }
}