Search in sources :

Example 11 with AllocatedEvaluator

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;
}
Also used : AllocatedEvaluator(org.apache.reef.driver.evaluator.AllocatedEvaluator) HashSet(java.util.HashSet)

Aggregations

AllocatedEvaluator (org.apache.reef.driver.evaluator.AllocatedEvaluator)11 Test (org.junit.Test)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 HashSet (java.util.HashSet)3 PackingPlan (com.twitter.heron.spi.packing.PackingPlan)2 ContainerPlan (com.twitter.heron.spi.packing.PackingPlan.ContainerPlan)2 EvaluatorDescriptor (org.apache.reef.driver.evaluator.EvaluatorDescriptor)2 Configuration (org.apache.reef.tang.Configuration)2 RoundRobinPacking (com.twitter.heron.packing.roundrobin.RoundRobinPacking)1 EvaluatorRequest (org.apache.reef.driver.evaluator.EvaluatorRequest)1 FailedEvaluator (org.apache.reef.driver.evaluator.FailedEvaluator)1