List of usage examples for org.apache.hadoop.yarn.api.records Container setId
@Private @Unstable public abstract void setId(ContainerId id);
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 w w w . j a v a2 s . com*/ * @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 ww w .ja va2 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:org.springframework.yarn.examples.grid.yarn.YarnManagedContainerGroupsTests.java
License:Apache License
/** * Mocks a yarn container with hostname hostname1 and container id {@link #CID1} * * @return the mocked Yarn Container/*www. ja va 2 s.co m*/ */ private Container mockContainer1() { Container container = Records.newRecord(Container.class); NodeId nodeId = Records.newRecord(NodeId.class); nodeId.setHost(HOST1); container.setNodeId(nodeId); ContainerId containerId = ConverterUtils.toContainerId(CID1); container.setId(containerId); return container; }
From source file:org.springframework.yarn.examples.grid.yarn.YarnManagedContainerGroupsTests.java
License:Apache License
/** * Mocks a yarn container with hostname hostname2 and container id {@link #CID2} * * @return the mocked Yarn Container/*ww w. j a va 2 s .c o m*/ */ private Container mockContainer2() { Container container = Records.newRecord(Container.class); NodeId nodeId = Records.newRecord(NodeId.class); nodeId.setHost(HOST2); container.setNodeId(nodeId); ContainerId containerId = ConverterUtils.toContainerId(CID2); container.setId(containerId); return container; }
From source file:org.springframework.yarn.examples.grid.yarn.YarnManagedContainerGroupsTests.java
License:Apache License
/** * Mocks a yarn container with hostname hostname3 and container id {@link #CID3} * * @return the mocked Yarn Container//w ww . j a va 2 s . c o m */ private Container mockContainer3() { Container container = Records.newRecord(Container.class); NodeId nodeId = Records.newRecord(NodeId.class); nodeId.setHost(HOST3); container.setNodeId(nodeId); ContainerId containerId = ConverterUtils.toContainerId(CID3); container.setId(containerId); return container; }
From source file:oz.hadoop.yarn.api.core.ApplicationContainerLauncherEmulatorImpl.java
License:Apache License
/** * /*from w w w. j a va2s. com*/ * @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); } }