@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;
}
};