use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction in project compss by bsc-wdc.
the class ScoresTest method testActionScores.
@SuppressWarnings("unchecked")
@Test
public void testActionScores() throws BlockedActionException, UnassignedActionException {
drs1.clear();
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 1, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action14 = new FakeAllocatableAction(fao, 14, 0, CoreManager.getCoreImplementations(0));
action14.selectExecution(drs2, (FakeImplementation) action14.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi14 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action14.getSchedulingInfo();
dsi14.setExpectedEnd(10_000);
FakeAllocatableAction action15 = new FakeAllocatableAction(fao, 15, 0, CoreManager.getCoreImplementations(0));
action15.selectExecution(drs2, (FakeImplementation) action15.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi15 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action15.getSchedulingInfo();
dsi15.setExpectedEnd(12_000);
FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Score score2 = ds.generateActionScore(action2);
Verifiers.verifyScore(score1, 1, 0, 0, 0, 0);
Verifiers.verifyScore((FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) score2, 0, 0, 0, 0, 0);
Verifiers.validateBetterScore(score1, score2, true);
action1.addDataPredecessor(action14);
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 1, 10_000, 0, 0, 10_000);
action1.addDataPredecessor(action15);
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 1, 12_000, 0, 0, 12_000);
}
use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction in project compss by bsc-wdc.
the class InitialSchedulingTest method testInitialScheduling.
@SuppressWarnings("unchecked")
@Test
public void testInitialScheduling() throws BlockedActionException, UnassignedActionException {
drs.clear();
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
action1.selectExecution(drs, (FakeImplementation) action1.getImplementations()[0]);
drs.scheduleAction(action1);
Verifiers.verifyInitialPlan(action1, CORE0);
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
action2.selectExecution(drs, (FakeImplementation) action2.getImplementations()[0]);
drs.scheduleAction(action2);
Verifiers.verifyInitialPlan(action2, CORE0);
FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 0, CoreManager.getCoreImplementations(1));
action3.selectExecution(drs, (FakeImplementation) action3.getImplementations()[0]);
drs.scheduleAction(action3);
Verifiers.verifyInitialPlan(action3, CORE1, action1, action2);
FakeAllocatableAction action4 = new FakeAllocatableAction(fao, 4, 0, CoreManager.getCoreImplementations(0));
action4.selectExecution(drs, (FakeImplementation) action4.getImplementations()[0]);
drs.scheduleAction(action4);
Verifiers.verifyInitialPlan(action4, CORE0, action2, action3);
FakeAllocatableAction action5 = new FakeAllocatableAction(fao, 5, 0, CoreManager.getCoreImplementations(0));
action5.selectExecution(drs, (FakeImplementation) action5.getImplementations()[0]);
drs.scheduleAction(action5);
Verifiers.verifyInitialPlan(action5, CORE0, action3);
FakeAllocatableAction action6 = new FakeAllocatableAction(fao, 6, 0, CoreManager.getCoreImplementations(1));
action6.selectExecution(drs, (FakeImplementation) action6.getImplementations()[0]);
drs.scheduleAction(action6);
Verifiers.verifyInitialPlan(action6, CORE1, action4, action5);
FakeAllocatableAction action7 = new FakeAllocatableAction(fao, 7, 0, CoreManager.getCoreImplementations(2));
action7.selectExecution(drs, (FakeImplementation) action7.getImplementations()[0]);
drs.scheduleAction(action7);
Verifiers.verifyInitialPlan(action7, CORE2, action5);
FakeAllocatableAction action8 = new FakeAllocatableAction(fao, 8, 0, CoreManager.getCoreImplementations(2));
action8.selectExecution(drs, (FakeImplementation) action8.getImplementations()[0]);
drs.scheduleAction(action8);
Verifiers.verifyInitialPlan(action8, CORE2, action7);
FakeAllocatableAction action9 = new FakeAllocatableAction(fao, 9, 0, CoreManager.getCoreImplementations(1));
action9.selectExecution(drs, (FakeImplementation) action9.getImplementations()[0]);
drs.scheduleAction(action9);
Verifiers.verifyInitialPlan(action9, CORE1, action6);
FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(0));
action10.selectExecution(drs, (FakeImplementation) action10.getImplementations()[0]);
drs.scheduleAction(action10);
Verifiers.verifyInitialPlan(action10, CORE0, action8, action9);
FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(0));
action11.selectExecution(drs, (FakeImplementation) action11.getImplementations()[0]);
drs.scheduleAction(action11);
Verifiers.verifyInitialPlan(action11, CORE0, action9);
}
use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction in project compss by bsc-wdc.
the class OptimizationTest method testScan.
// @Test
@SuppressWarnings("unchecked")
public void testScan() {
FakeAllocatableAction external10 = new FakeAllocatableAction(fao, 13, 0, CoreManager.getCoreImplementations(4));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external10.getSchedulingInfo()).setExpectedEnd(10);
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external10.getSchedulingInfo()).scheduled();
external10.selectExecution(drs2, (FakeImplementation) external10.getImplementations()[0]);
FakeAllocatableAction external20 = new FakeAllocatableAction(fao, 14, 0, CoreManager.getCoreImplementations(4));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external20.getSchedulingInfo()).setExpectedEnd(20);
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external20.getSchedulingInfo()).scheduled();
external20.selectExecution(drs2, (FakeImplementation) external20.getImplementations()[0]);
FakeAllocatableAction external90 = new FakeAllocatableAction(fao, 15, 0, CoreManager.getCoreImplementations(4));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external90.getSchedulingInfo()).setExpectedEnd(90);
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external90.getSchedulingInfo()).scheduled();
external90.selectExecution(drs2, (FakeImplementation) external90.getImplementations()[0]);
drs1.clear();
drs2.clear();
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(4));
action1.selectExecution(drs1, (FakeImplementation) action1.getImplementations()[0]);
drs1.scheduleAction(action1);
try {
action1.tryToLaunch();
} catch (Exception e) {
}
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(4));
action2.selectExecution(drs1, (FakeImplementation) action2.getImplementations()[0]);
drs1.scheduleAction(action2);
try {
action2.tryToLaunch();
} catch (Exception e) {
}
FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 1, CoreManager.getCoreImplementations(4));
action3.addDataPredecessor(external90);
action3.selectExecution(drs1, (FakeImplementation) action3.getImplementations()[0]);
drs1.scheduleAction(action3);
FakeAllocatableAction action4 = new FakeAllocatableAction(fao, 4, 0, CoreManager.getCoreImplementations(5));
action4.selectExecution(drs1, (FakeImplementation) action4.getImplementations()[0]);
drs1.scheduleAction(action4);
FakeAllocatableAction action5 = new FakeAllocatableAction(fao, 5, 1, CoreManager.getCoreImplementations(4));
action5.selectExecution(drs1, (FakeImplementation) action5.getImplementations()[0]);
drs1.scheduleAction(action5);
FakeAllocatableAction action6 = new FakeAllocatableAction(fao, 6, 1, CoreManager.getCoreImplementations(6));
action6.selectExecution(drs1, (FakeImplementation) action6.getImplementations()[0]);
drs1.scheduleAction(action6);
FakeAllocatableAction action7 = new FakeAllocatableAction(fao, 7, 0, CoreManager.getCoreImplementations(5));
action7.addDataPredecessor(external10);
action7.selectExecution(drs1, (FakeImplementation) action7.getImplementations()[0]);
drs1.scheduleAction(action7);
FakeAllocatableAction action8 = new FakeAllocatableAction(fao, 8, 0, CoreManager.getCoreImplementations(5));
action8.addDataPredecessor(external20);
action8.selectExecution(drs1, (FakeImplementation) action8.getImplementations()[0]);
drs1.scheduleAction(action8);
FakeAllocatableAction action9 = new FakeAllocatableAction(fao, 9, 0, CoreManager.getCoreImplementations(4));
action9.addDataPredecessor(external90);
action9.selectExecution(drs1, (FakeImplementation) action9.getImplementations()[0]);
drs1.scheduleAction(action9);
FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(4));
action10.addDataPredecessor(action5);
action10.selectExecution(drs1, (FakeImplementation) action10.getImplementations()[0]);
drs1.scheduleAction(action10);
FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(4));
action11.addDataPredecessor(action6);
action11.selectExecution(drs1, (FakeImplementation) action11.getImplementations()[0]);
drs1.scheduleAction(action11);
FakeAllocatableAction action12 = new FakeAllocatableAction(fao, 12, 0, CoreManager.getCoreImplementations(4));
action12.addDataPredecessor(action5);
action12.addDataPredecessor(action6);
action12.selectExecution(drs1, (FakeImplementation) action12.getImplementations()[0]);
drs1.scheduleAction(action12);
// Actions not depending on other actions scheduled on the same resource
// Sorted by data dependencies release
PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> readyActions = new PriorityQueue<>(1, FullGraphResourceScheduler.getReadyComparator());
// Actions that can be selected to be scheduled on the node
// Sorted by data dependencies release
PriorityActionSet<FakeProfile, FakeResourceDescription, FakeImplementation> selectableActions = new PriorityActionSet<>(FullGraphResourceScheduler.getScanComparator());
drs1.scanActions(readyActions, selectableActions);
HashMap<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>, Long> expectedReady = new HashMap<>();
expectedReady.put(action7, 10l);
expectedReady.put(action8, 20l);
expectedReady.put(action9, 90l);
expectedReady.put(action3, 90l);
Verifiers.verifyReadyActions(new PriorityQueue<>(readyActions), expectedReady);
AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>[] expectedSelectable = new AllocatableAction[] { action5, action6, action4 };
Verifiers.verifyPriorityActions(new PriorityActionSet<>(selectableActions), expectedSelectable);
}
use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction in project compss by bsc-wdc.
the class OptimizationTest method testNoDataDependencies.
// @Test
@SuppressWarnings("unchecked")
public void testNoDataDependencies() throws BlockedActionException, UnassignedActionException, InvalidSchedulingException, InterruptedException {
// Build graph
/*
* 1 --> 3 --> 5 -->6 --> 8 -->9 ----->11 -->12 --> 13 2 --> 4 ┘ └->7 ┘ └->10 ---| └-----┘ | |
* ------------------------------------------------------- 14┘ 15┘
*/
drs1.clear();
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action4 = new FakeAllocatableAction(fao, 4, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action5 = new FakeAllocatableAction(fao, 5, 0, CoreManager.getCoreImplementations(1));
FakeAllocatableAction action6 = new FakeAllocatableAction(fao, 6, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action7 = new FakeAllocatableAction(fao, 7, 0, CoreManager.getCoreImplementations(2));
FakeAllocatableAction action8 = new FakeAllocatableAction(fao, 8, 0, CoreManager.getCoreImplementations(3));
FakeAllocatableAction action9 = new FakeAllocatableAction(fao, 9, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(2));
FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(3));
FakeAllocatableAction action12 = new FakeAllocatableAction(fao, 12, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action13 = new FakeAllocatableAction(fao, 13, 0, CoreManager.getCoreImplementations(1));
FakeAllocatableAction action14 = new FakeAllocatableAction(fao, 14, 0, CoreManager.getCoreImplementations(0));
action14.selectExecution(drs2, (FakeImplementation) action14.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi14 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action14.getSchedulingInfo();
dsi14.setExpectedEnd(10_000);
FakeAllocatableAction action15 = new FakeAllocatableAction(fao, 15, 0, CoreManager.getCoreImplementations(0));
action15.selectExecution(drs2, (FakeImplementation) action15.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi15 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action15.getSchedulingInfo();
dsi15.setExpectedEnd(12_000);
action1.selectExecution(drs1, (FakeImplementation) action1.getImplementations()[0]);
action1.tryToLaunch();
action2.selectExecution(drs1, (FakeImplementation) action2.getImplementations()[0]);
action2.tryToLaunch();
action3.selectExecution(drs1, (FakeImplementation) action3.getImplementations()[0]);
addSchedulingDependency(action1, action3);
action4.selectExecution(drs1, (FakeImplementation) action4.getImplementations()[0]);
addSchedulingDependency(action2, action4);
action5.selectExecution(drs1, (FakeImplementation) action5.getImplementations()[0]);
action5.addDataPredecessor(action2);
addSchedulingDependency(action3, action5);
addSchedulingDependency(action4, action5);
action6.selectExecution(drs1, (FakeImplementation) action6.getImplementations()[0]);
action6.addDataPredecessor(action2);
addSchedulingDependency(action5, action6);
action7.selectExecution(drs1, (FakeImplementation) action7.getImplementations()[0]);
action7.addDataPredecessor(action2);
addSchedulingDependency(action5, action7);
action8.selectExecution(drs1, (FakeImplementation) action8.getImplementations()[0]);
action8.addDataPredecessor(action5);
addSchedulingDependency(action6, action8);
addSchedulingDependency(action7, action8);
action9.selectExecution(drs1, (FakeImplementation) action9.getImplementations()[0]);
addSchedulingDependency(action8, action9);
action9.addDataPredecessor(action5);
action10.selectExecution(drs1, (FakeImplementation) action10.getImplementations()[0]);
addSchedulingDependency(action8, action10);
action11.selectExecution(drs1, (FakeImplementation) action11.getImplementations()[0]);
addSchedulingDependency(action9, action11);
addSchedulingDependency(action10, action11);
action11.addDataPredecessor(action14);
action12.selectExecution(drs1, (FakeImplementation) action12.getImplementations()[0]);
addSchedulingDependency(action11, action12);
action13.selectExecution(drs1, (FakeImplementation) action13.getImplementations()[0]);
addSchedulingDependency(action11, action13);
addSchedulingDependency(action12, action13);
action13.addDataPredecessor(action15);
// debugActions(action1, action2, action3, action4, action5, action6, action7, action8, action9, action10,
// action11, action12, action13 );
LinkedList<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>>[] actions = new LinkedList[CoreManager.getCoreCount()];
for (int i = 0; i < actions.length; i++) {
actions[i] = new LinkedList<>();
}
// Actions not depending on other actions scheduled on the same resource
// Sorted by data dependencies release
PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> readyActions = new PriorityQueue<>(1, FullGraphResourceScheduler.getReadyComparator());
// Actions that can be selected to be scheduled on the node
// Sorted by data dependencies release
PriorityActionSet<FakeProfile, FakeResourceDescription, FakeImplementation> selectableActions = new PriorityActionSet<>(FullGraphResourceScheduler.getScanComparator());
LinkedList<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> runningActions = drs1.scanActions(readyActions, selectableActions);
HashMap<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>, Long> expectedReady = new HashMap<>();
expectedReady.put(action11, 10_000l);
expectedReady.put(action13, 12_000l);
Verifiers.verifyReadyActions(new PriorityQueue<>(readyActions), expectedReady);
AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>[] expectedSelectable = new AllocatableAction[] { action3, action4, action10, action12 };
Verifiers.verifyPriorityActions(new PriorityActionSet<FakeProfile, FakeResourceDescription, FakeImplementation>(selectableActions), expectedSelectable);
PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> donationActions = new PriorityQueue<>(1, ScheduleOptimizer.getDonationComparator());
drs1.rescheduleTasks(System.currentTimeMillis(), readyActions, selectableActions, runningActions, donationActions);
/*
* drs.seekGaps(System.currentTimeMillis(), gaps, actions);
*
* long[][][] times = { new long[][]{//CORE 0 new long[]{0, CORE0}, //1 new long[]{0, CORE0}, //2 new
* long[]{CORE0, 2 * CORE0}, //3 new long[]{CORE0, 2 * CORE0}, //4 new long[]{2 * CORE0 + CORE1, 3 * CORE0 +
* CORE1}, //6 new long[]{3 * CORE0 + CORE1 + CORE3, 4 * CORE0 + CORE1 + CORE3}, //9 new long[]{10_000 + CORE3,
* 10_000 + CORE3 + CORE0}, //12 }, new long[][]{//CORE 1 new long[]{2 * CORE0, 2 * CORE0 + CORE1}, //5 new
* long[]{12_000, 12_000 + CORE1}, //13 }, new long[][]{//CORE 2 new long[]{2 * CORE0 + CORE1, 2 * CORE0 + CORE1
* + CORE2}, //7 new long[]{3 * CORE0 + CORE1 + CORE3, 3 * CORE0 + CORE1 + CORE2 + CORE3}, //10 }, new
* long[][]{//CORE 3 new long[]{3 * CORE0 + CORE1, 3 * CORE0 + CORE1 + CORE3}, //8 new long[]{10_000, 10_000 +
* CORE3}, //11 },}; Verifiers.verifyUpdate(actions, times);
*
* Gap[] expectedGaps = { new Gap(2 * CORE0, 3 * CORE0 + CORE1, action3, new FakeResourceDescription(1), 0), new
* Gap(2 * CORE0 + CORE1 + CORE2, 3 * CORE0 + CORE1, action7, new FakeResourceDescription(1), 0), new Gap(3 *
* CORE0 + CORE1 + CORE3, 10_000, action8, new FakeResourceDescription(1), 0), new Gap(3 * CORE0 + CORE1 + CORE2
* + CORE3, 10_000, action10, new FakeResourceDescription(1), 0), new Gap(4 * CORE0 + CORE1 + CORE3, 10_000,
* action9, new FakeResourceDescription(2), 0), new Gap(10_000 + CORE3 + CORE0, 12_000, action12, new
* FakeResourceDescription(2), 0), new Gap(10_000 + CORE3, 12_000, action11, new FakeResourceDescription(1), 0),
* new Gap(10_000 + CORE3, Long.MAX_VALUE, action11, new FakeResourceDescription(1), 0), new Gap(12_000 + CORE1,
* Long.MAX_VALUE, action13, new FakeResourceDescription(3), 0),}; Verifiers.verifyGaps(gaps, expectedGaps);
*/
}
use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction in project compss by bsc-wdc.
the class PriorityActionSetTest method testInitialScheduling.
@SuppressWarnings("unchecked")
@Test
public void testInitialScheduling() throws BlockedActionException, UnassignedActionException {
PriorityActionSet<FakeProfile, FakeResourceDescription, FakeImplementation> pas = new PriorityActionSet<>(new Comparator<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>>() {
@Override
public int compare(AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation> o1, AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation> o2) {
return Long.compare(o1.getId(), o2.getId());
}
});
PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> peeks;
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action1.getSchedulingInfo()).setToReschedule(true);
pas.offer(action1);
if (action1 != pas.peek()) {
fail(action1 + " expected to be the most prioritary action and " + pas.peek() + " was.");
}
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action2.getSchedulingInfo()).setToReschedule(true);
pas.offer(action2);
if (action1 != pas.peek()) {
fail(action1 + " expected to be the most prioritary action and " + pas.peek() + " was.");
}
FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 0, null);
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action3.getSchedulingInfo()).setToReschedule(true);
pas.offer(action3);
if (action1 != pas.peek()) {
fail(action1 + " expected to be the most prioritary action and " + pas.peek() + " was.");
}
peeks = pas.peekAll();
AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>[] expectedPeeks = new AllocatableAction[] { action1, action3 };
Verifiers.verifyPriorityActions(peeks, expectedPeeks);
FakeAllocatableAction action4 = new FakeAllocatableAction(fao, 4, 0, CoreManager.getCoreImplementations(1));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action4.getSchedulingInfo()).setToReschedule(true);
pas.offer(action4);
peeks = pas.peekAll();
expectedPeeks = new AllocatableAction[] { action1, action3, action4 };
Verifiers.verifyPriorityActions(peeks, expectedPeeks);
AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation> action = pas.poll();
if (action1 != action) {
fail(action1 + " expected to be the most prioritary action and " + action + " was.");
}
peeks = pas.peekAll();
expectedPeeks = new AllocatableAction[] { action2, action3, action4 };
Verifiers.verifyPriorityActions(peeks, expectedPeeks);
action = pas.poll();
if (action2 != action) {
fail(action2 + " expected to be the most prioritary action and " + action + " was.");
}
peeks = pas.peekAll();
expectedPeeks = new AllocatableAction[] { action3, action4 };
Verifiers.verifyPriorityActions(peeks, expectedPeeks);
action = pas.poll();
if (action3 != action) {
fail(action3 + " expected to be the most prioritary action and " + action + " was.");
}
peeks = pas.peekAll();
expectedPeeks = new AllocatableAction[] { action4 };
Verifiers.verifyPriorityActions(peeks, expectedPeeks);
action = pas.poll();
if (action4 != action) {
fail(action4 + " expected to be the most prioritary action and " + action + " was.");
}
peeks = pas.peekAll();
expectedPeeks = new AllocatableAction[] {};
Verifiers.verifyPriorityActions(peeks, expectedPeeks);
FakeAllocatableAction action5 = new FakeAllocatableAction(fao, 5, 0, CoreManager.getCoreImplementations(1));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action5.getSchedulingInfo()).setToReschedule(true);
FakeAllocatableAction action6 = new FakeAllocatableAction(fao, 6, 0, CoreManager.getCoreImplementations(1));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action6.getSchedulingInfo()).setToReschedule(true);
pas.offer(action6);
action = pas.peek();
if (action6 != action) {
fail(action6 + " expected to be the most prioritary action and " + action + " was.");
}
pas.offer(action5);
action = pas.peek();
if (action5 != action) {
fail(action5 + " expected to be the most prioritary action and " + action + " was.");
}
}
Aggregations