public Container createContainer(Resource capability, Priority priority, String hostname, int port, String nodeHttpAddress) { ContainerId containerId = ContainerId.newContainerId(customAppAttemptId, nextId.getAndIncrement()); NodeId nodeId = NodeId.newInstance(hostname, port); Container container = Container.newInstance(containerId, nodeId, nodeHttpAddress, capability, priority, null); return container; } }
public Container createContainer(Resource capability, Priority priority, String hostname, int port, String nodeHttpAddress) { ContainerId containerId = ContainerId.newContainerId(customAppAttemptId, nextId.getAndIncrement()); NodeId nodeId = NodeId.newInstance(hostname, port); Container container = Container.newInstance(containerId, nodeId, nodeHttpAddress, capability, priority, null); return container; } }
@SuppressWarnings("deprecation") public Container createContainer(Resource capability, Priority priority) { ContainerId containerId = ContainerId.newInstance(customAppAttemptId, nextId.getAndIncrement()); NodeId nodeId = NodeId.newInstance("127.0.0.1", 0); String nodeHttpAddress = "127.0.0.1:0"; Container container = Container.newInstance(containerId, nodeId, nodeHttpAddress, capability, priority, null); return container; } }
@Private @Unstable public static Container newInstance(ContainerId containerId, NodeId nodeId, String nodeHttpAddress, Resource resource, Priority priority, Token containerToken) { return newInstance(containerId, nodeId, nodeHttpAddress, resource, priority, containerToken, ExecutionType.GUARANTEED); }
@Override public List<Container> getContainers(TaskType t) { List<Container> p = new ArrayList<Container>(); for (Map.Entry<ContainerId,TaskAttemptId> ent : assignedContainers.entrySet()) { if (ent.getValue().getTaskId().getTaskType().equals(t)) { p.add(Container.newInstance(ent.getKey(), null, null, contToResourceMap.get(ent.getKey()), Priority.newInstance(0), null)); } } return p; } };
@Override public List<Container> getContainers(TaskType t) { List<Container> p = new ArrayList<Container>(); for (Map.Entry<ContainerId,TaskAttemptId> ent : assignedContainers.entrySet()){ if(ent.getValue().getTaskId().getTaskType().equals(t)){ p.add(Container.newInstance(ent.getKey(), null, null, contToResourceMap.get(ent.getKey()), Priority.newInstance(0), null)); } } return p; } };
private Container getIncreasedContainer(int containerID, int appAttemptId, int memory, int vCores) { ContainerId containerId = getContainerId(containerID, appAttemptId); Resource capability = Resource.newInstance(memory, vCores); return Container.newInstance( containerId, null, null, capability, null, null); }
private Container getDecreasedContainer(int containerID, int appAttemptId, int memory, int vCores) { ContainerId containerId = getContainerId(containerID, appAttemptId); Resource capability = Resource.newInstance(memory, vCores); return Container.newInstance( containerId, null, null, capability, null, null); }
public ContainerId assignContainer(String nodeName, boolean isReduce) { ContainerId containerId = ContainerId.newContainerId(attemptId, nextContainerId++); Priority priority = isReduce ? RMContainerAllocator.PRIORITY_REDUCE : RMContainerAllocator.PRIORITY_MAP; Container container = Container.newInstance(containerId, NodeId.newInstance(nodeName, 1234), nodeName + ":5678", Resource.newInstance(1024, 1), priority, null); containersToAllocate.add(container); return containerId; }
private Container getContainer( MockRM rm, ContainerId containerId, Resource resource) { RMContainer rmContainer = rm.getResourceScheduler() .getRMContainer(containerId); return Container.newInstance( containerId, rmContainer.getAllocatedNode(), null, resource, null, null); } }
containersFromPreviousAttempt.add(Container.newInstance(containerId, null, null, null, null, null));
private void cancelPreviousRequest(SchedulerNode schedulerNode, SchedulerRequestKey schedulerKey) { AppPlacementAllocator<SchedulerNode> appPlacementAllocator = appSchedulingInfo.getAppPlacementAllocator(schedulerKey); if (appPlacementAllocator != null) { PendingAsk pendingAsk = appPlacementAllocator.getPendingAsk( ResourceRequest.ANY); // Decrement the pending using a dummy RR with // resource = prev update req capability if (pendingAsk != null && pendingAsk.getCount() > 0) { appSchedulingInfo.allocate(NodeType.OFF_SWITCH, schedulerNode, schedulerKey, Container.newInstance(UNDEFINED, schedulerNode.getNodeID(), "host:port", pendingAsk.getPerAllocationResource(), schedulerKey.getPriority(), null)); } } }
private RMContainer recoverAndCreateContainer(NMContainerStatus status, RMNode node) { Container container = Container.newInstance(status.getContainerId(), node.getNodeID(), node.getHttpAddress(), status.getAllocatedResource(), status.getPriority(), null); ApplicationAttemptId attemptId = container.getId().getApplicationAttemptId(); RMContainer rmContainer = new RMContainerImpl(container, attemptId, node.getNodeID(), applications.get(attemptId.getApplicationId()).getUser(), rmContext, status.getCreationTime()); return rmContainer; }
private RMContainer recoverAndCreateContainer(NMContainerStatus status, RMNode node) { Container container = Container.newInstance(status.getContainerId(), node.getNodeID(), node.getHttpAddress(), status.getAllocatedResource(), status.getPriority(), null); ApplicationAttemptId attemptId = container.getId().getApplicationAttemptId(); RMContainer rmContainer = new RMContainerImpl(container, attemptId, node.getNodeID(), applications.get(attemptId.getApplicationId()).getUser(), rmContext, status.getCreationTime()); return rmContainer; }
MRBuilderUtils.newJobId(appId, 1), 1, TaskType.MAP), 0)); List<Container> p = new ArrayList<Container>(); p.add(Container.newInstance(container, null, null, null, null, null)); when(mPctxt.getContainers(any(TaskType.class))).thenReturn(p);
private ResourceCommitRequest createAllocateFromReservedProposal( int containerId, Resource allocateResource, FiCaSchedulerApp schedulerApp, SchedulerNode allocateNode, SchedulerNode reservedNode, RMContext rmContext, RMContainer reservedContainer) { Container container = Container.newInstance( ContainerId.newContainerId(schedulerApp.getApplicationAttemptId(), containerId), allocateNode.getNodeID(), allocateNode.getHttpAddress(), allocateResource, Priority.newInstance(0), null); RMContainer rmContainer = new RMContainerImpl(container, SchedulerRequestKey .create(ResourceRequest .newInstance(Priority.newInstance(0), "*", allocateResource, 1)), schedulerApp.getApplicationAttemptId(), allocateNode.getNodeID(), "user", rmContext); SchedulerContainer allocateContainer = new SchedulerContainer(schedulerApp, allocateNode, rmContainer, "", true); SchedulerContainer reservedSchedulerContainer = new SchedulerContainer(schedulerApp, reservedNode, reservedContainer, "", false); List<SchedulerContainer> toRelease = new ArrayList<>(); toRelease.add(reservedSchedulerContainer); ContainerAllocationProposal allocateFromReservedProposal = new ContainerAllocationProposal(allocateContainer, toRelease, null, NodeType.OFF_SWITCH, NodeType.OFF_SWITCH, SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY, allocateResource); List<ContainerAllocationProposal> allocateProposals = new ArrayList<>(); allocateProposals.add(allocateFromReservedProposal); return new ResourceCommitRequest(allocateProposals, null, null); }
private RMContainer recoverAndCreateContainer(NMContainerStatus status, RMNode node, String queueName) { Container container = Container.newInstance(status.getContainerId(), node.getNodeID(), node.getHttpAddress(), status.getAllocatedResource(), status.getPriority(), null); container.setVersion(status.getVersion()); container.setExecutionType(status.getExecutionType()); container.setAllocationRequestId(status.getAllocationRequestId()); container.setAllocationTags(status.getAllocationTags()); ApplicationAttemptId attemptId = container.getId().getApplicationAttemptId(); RMContainer rmContainer = new RMContainerImpl(container, SchedulerRequestKey.extractFrom(container), attemptId, node.getNodeID(), applications.get(attemptId.getApplicationId()).getUser(), rmContext, status.getCreationTime(), status.getNodeLabelExpression()); ((RMContainerImpl) rmContainer).setQueueName(queueName); return rmContainer; }
updated.add(UpdatedContainer .newInstance(ContainerUpdateType.PROMOTE_EXECUTION_TYPE, Container .newInstance(createContainerId(2), null, null, null, null, null))); updated.add(UpdatedContainer .newInstance(ContainerUpdateType.PROMOTE_EXECUTION_TYPE, Container .newInstance(createContainerId(5), null, null, null, null, null))); this.mockAMS.response.setUpdatedContainers(updated);
Resource resourceToRelease = createResourceToRelease( existingRMContainer.getContainer(), updateType); Container newContainer = Container.newInstance(matchedContainerId, existingRMContainer.getContainer().getNodeId(), existingRMContainer.getContainer().getNodeHttpAddress(),
@Override public void handle(ContainerAllocatorEvent event) { ContainerId cId = ContainerId.newContainerId(getContext().getApplicationAttemptId(), containerCount++); NodeId nodeId = NodeId.newInstance(NM_HOST, NM_PORT); ContainerTokenIdentifier containerTokenIdentifier = new ContainerTokenIdentifier(cId, nodeId.toString(), "user", resource, System.currentTimeMillis() + 10000, 42, 42, Priority.newInstance(0), 0); Token containerToken = newContainerToken(nodeId, "password".getBytes(), containerTokenIdentifier); Container container = Container.newInstance(cId, nodeId, NM_HOST + ":" + NM_HTTP_PORT, resource, null, containerToken); JobID id = TypeConverter.fromYarn(applicationId); JobId jobId = TypeConverter.toYarn(id); getContext().getEventHandler().handle(new JobHistoryEvent(jobId, new NormalizedResourceEvent( org.apache.hadoop.mapreduce.TaskType.REDUCE, 100))); getContext().getEventHandler().handle(new JobHistoryEvent(jobId, new NormalizedResourceEvent( org.apache.hadoop.mapreduce.TaskType.MAP, 100))); getContext().getEventHandler().handle( new TaskAttemptContainerAssignedEvent(event.getAttemptID(), container, null)); }