use of es.bsc.es.bsc.compss.scheduler.types.OptimizationWorker in project compss by bsc-wdc.
the class OptimizationTest method testDonorsAndReceivers.
// @Test
@SuppressWarnings("unchecked")
public void testDonorsAndReceivers() {
ScheduleOptimizer<FakeProfile, FakeResourceDescription, FakeImplementation> so = new ScheduleOptimizer<>(ds);
long[] expectedEndTimes = new long[] { 35000, 20000, 15000, 50000, 40000, 1000 };
OptimizationWorker<FakeProfile, FakeResourceDescription, FakeImplementation>[] optimizedWorkers = new OptimizationWorker[expectedEndTimes.length];
for (int idx = 0; idx < expectedEndTimes.length; idx++) {
int maxSlots = 1;
FakeResourceDescription frd = new FakeResourceDescription(maxSlots);
FakeWorker fw = new FakeWorker("worker" + idx, frd, maxSlots);
FakeResourceScheduler frs = new FakeResourceScheduler(fw, fao, expectedEndTimes[idx]);
optimizedWorkers[idx] = new OptimizationWorker<>(frs);
}
LinkedList<OptimizationWorker<FakeProfile, FakeResourceDescription, FakeImplementation>> receivers = new LinkedList<>();
OptimizationWorker<FakeProfile, FakeResourceDescription, FakeImplementation> donor = so.determineDonorAndReceivers(optimizedWorkers, receivers);
LinkedList<OptimizationWorker<FakeProfile, FakeResourceDescription, FakeImplementation>> donors = new LinkedList<>();
donors.offer(donor);
LinkedList<String> donorsNames = new LinkedList<>();
donorsNames.add("worker3");
LinkedList<String> receiversNames = new LinkedList<>();
receiversNames.add("worker5");
receiversNames.add("worker2");
receiversNames.add("worker1");
receiversNames.add("worker0");
receiversNames.add("worker4");
Verifiers.verifyWorkersPriority(donors, donorsNames);
Verifiers.verifyWorkersPriority(receivers, receiversNames);
}
Aggregations