@Override public DistributedSchedulingAllocateResponse allocateForDistributedScheduling( DistributedSchedulingAllocateRequest request) throws YarnException, IOException { List<Container> distAllocContainers = request.getAllocatedContainers(); handleNewContainers(distAllocContainers, true); AllocateResponse response = allocate(request.getAllocateRequest()); DistributedSchedulingAllocateResponse dsResp = recordFactory .newRecordInstance(DistributedSchedulingAllocateResponse.class); dsResp.setAllocateResponse(response); dsResp.setNodesForScheduling(getLeastLoadedNodes()); return dsResp; }
/** * Route allocate call to the allocateForDistributedScheduling method and * return response to the caller after stripping away Distributed Scheduling * information. * * @param request * allocation request * @return Allocate Response * @throws YarnException YarnException * @throws IOException IOException */ @Override public AllocateResponse allocate(AllocateRequest request) throws YarnException, IOException { DistributedSchedulingAllocateRequest distRequest = RECORD_FACTORY .newRecordInstance(DistributedSchedulingAllocateRequest.class); distRequest.setAllocateRequest(request); return allocateForDistributedScheduling(distRequest).getAllocateResponse(); }
.partitionAskList(request.getAllocateRequest().getAskList()); request.getAllocateRequest().getResourceBlacklistRequest(), partitionedAsks.getOpportunistic(), applicationAttemptId, oppContainerContext, rmIdentifier, appSubmitter); request.setAllocatedContainers(allocatedContainers); request.getAllocateRequest().setAskList(partitionedAsks.getGuaranteed());
@Override public DistributedSchedulingAllocateResponse allocateForDistributedScheduling( DistributedSchedulingAllocateRequest request) throws YarnException, IOException { List<ResourceRequest> askList = request.getAllocateRequest().getAskList(); List<Container> allocatedContainers = request.getAllocatedContainers(); Assert.assertEquals(1, allocatedContainers.size()); Assert.assertEquals(ExecutionType.OPPORTUNISTIC, allocatedContainers.get(0).getExecutionType()); Assert.assertEquals(1, askList.size()); Assert.assertTrue(askList.get(0) .getExecutionTypeRequest().getEnforceExecutionType()); DistributedSchedulingAllocateResponse resp = factory .newRecordInstance(DistributedSchedulingAllocateResponse.class); RemoteNode remoteNode1 = RemoteNode.newInstance( NodeId.newInstance("h1", 1234), "http://h1:4321"); RemoteNode remoteNode2 = RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "http://h2:4321"); remoteNode2.setNodePartition("l1"); resp.setNodesForScheduling( Arrays.asList(remoteNode1, remoteNode2)); return resp; } };