use of org.apache.reef.driver.evaluator.AllocatedEvaluator in project heron by twitter.
the class HeronMasterDriverTest method simulateContainerAllocation.
private AllocatedEvaluator simulateContainerAllocation(String evaluatorId, int cores, ByteAmount ram, int workerId) {
AllocatedEvaluator evaluator = createMockEvaluator(evaluatorId, cores, ram);
HeronMasterDriver.HeronWorker worker = new HeronMasterDriver.HeronWorker(workerId, cores, ram);
Set<HeronMasterDriver.HeronWorker> workers = new HashSet<>();
workers.add(worker);
doReturn(workers).when(spyDriver).getWorkersAwaitingAllocation();
doReturn(Optional.of(worker)).when(spyDriver).findLargestFittingWorker(eq(evaluator), eq(workers), eq(false));
spyDriver.new ContainerAllocationHandler().onNext(evaluator);
return evaluator;
}
Aggregations