Search in sources :

Example 1 with FakeResourceDescription

use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription in project compss by bsc-wdc.

the class OptimizationTest method globalOptimization.

// @Test
public void globalOptimization() {
    ScheduleOptimizer<FakeProfile, FakeResourceDescription, FakeImplementation> so = new ScheduleOptimizer<>(ds);
    long updateId = System.currentTimeMillis();
    Collection<ResourceScheduler<FakeProfile, FakeResourceDescription, FakeImplementation>> workers = new ArrayList<>();
    drs1.clear();
    drs2.clear();
    workers.add(drs1);
    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.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);
    workers.add(drs2);
    so.globalOptimization(updateId, workers);
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) ScheduleOptimizer(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.ScheduleOptimizer) ArrayList(java.util.ArrayList) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) FakeResourceScheduler(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceScheduler) ResourceScheduler(es.bsc.compss.components.impl.ResourceScheduler) FullGraphResourceScheduler(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphResourceScheduler) BlockedActionException(es.bsc.es.bsc.compss.scheduler.exceptions.BlockedActionException) InvalidSchedulingException(es.bsc.es.bsc.compss.scheduler.exceptions.InvalidSchedulingException) UnassignedActionException(es.bsc.es.bsc.compss.scheduler.exceptions.UnassignedActionException)

Example 2 with FakeResourceDescription

use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription in project compss by bsc-wdc.

the class OptimizationTest method testLocalOptimization.

@SuppressWarnings("static-access")
@Test
public void testLocalOptimization() {
    drs1.clear();
    drs2.clear();
    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]);
    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);
    // Simulate Scan results
    LinkedList<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> runningActions = new LinkedList<>();
    PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> readyActions = new PriorityQueue<>(1, drs1.getReadyComparator());
    PriorityActionSet<FakeProfile, FakeResourceDescription, FakeImplementation> selectableActions = new PriorityActionSet<>(ScheduleOptimizer.getSelectionComparator());
    long updateId = System.currentTimeMillis();
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action1.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action1.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action1.getSchedulingInfo()).setExpectedStart(0);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action1.getSchedulingInfo()).lock();
    runningActions.add(action1);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action2.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action2.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action2.getSchedulingInfo()).setExpectedStart(0);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action2.getSchedulingInfo()).lock();
    runningActions.add(action2);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action3.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action3.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action3.getSchedulingInfo()).setExpectedStart(90);
    readyActions.offer(action3);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action4.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action4.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action4.getSchedulingInfo()).setExpectedStart(0);
    selectableActions.offer(action4);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action5.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action5.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action5.getSchedulingInfo()).setExpectedStart(0);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action5.getSchedulingInfo()).optimizingSuccessor(action12);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action5.getSchedulingInfo()).optimizingSuccessor(action10);
    selectableActions.offer(action5);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action6.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action6.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action6.getSchedulingInfo()).setExpectedStart(0);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action6.getSchedulingInfo()).optimizingSuccessor(action12);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action6.getSchedulingInfo()).optimizingSuccessor(action11);
    selectableActions.offer(action6);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action7.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action7.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action7.getSchedulingInfo()).setExpectedStart(10);
    readyActions.offer(action7);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action8.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action8.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action8.getSchedulingInfo()).setExpectedStart(20);
    readyActions.offer(action8);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action9.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action9.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action9.getSchedulingInfo()).setExpectedStart(90);
    readyActions.offer(action9);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action10.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action10.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action10.getSchedulingInfo()).setExpectedStart(0);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action11.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action11.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action11.getSchedulingInfo()).setExpectedStart(0);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action12.getSchedulingInfo()).setOnOptimization(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action12.getSchedulingInfo()).setToReschedule(true);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action12.getSchedulingInfo()).setExpectedStart(0);
    PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> donationActions = new PriorityQueue<>(1, ScheduleOptimizer.getDonationComparator());
    drs1.rescheduleTasks(updateId, readyActions, selectableActions, runningActions, donationActions);
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) AllocatableAction(es.bsc.es.bsc.compss.scheduler.types.AllocatableAction) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) PriorityQueue(java.util.PriorityQueue) PriorityActionSet(es.bsc.es.bsc.compss.scheduler.types.PriorityActionSet) BlockedActionException(es.bsc.es.bsc.compss.scheduler.exceptions.BlockedActionException) InvalidSchedulingException(es.bsc.es.bsc.compss.scheduler.exceptions.InvalidSchedulingException) UnassignedActionException(es.bsc.es.bsc.compss.scheduler.exceptions.UnassignedActionException) LinkedList(java.util.LinkedList) FullGraphSchedulingInformation(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphSchedulingInformation) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) Test(org.junit.Test)

Example 3 with FakeResourceDescription

use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription in project compss by bsc-wdc.

the class OptimizationTest method testPendingActions.

// @Test
@SuppressWarnings("unchecked")
public void testPendingActions() {
    LinkedList<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> pendingActions = new LinkedList<>();
    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]);
    pendingActions.add(action7);
    FakeAllocatableAction action8 = new FakeAllocatableAction(fao, 8, 0, CoreManager.getCoreImplementations(5));
    action8.addDataPredecessor(external20);
    action8.selectExecution(drs1, (FakeImplementation) action8.getImplementations()[0]);
    pendingActions.add(action8);
    FakeAllocatableAction action9 = new FakeAllocatableAction(fao, 9, 0, CoreManager.getCoreImplementations(4));
    action9.addDataPredecessor(external90);
    action9.selectExecution(drs1, (FakeImplementation) action9.getImplementations()[0]);
    pendingActions.add(action9);
    FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(4));
    action10.addDataPredecessor(action5);
    action10.selectExecution(drs1, (FakeImplementation) action10.getImplementations()[0]);
    pendingActions.add(action10);
    FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(4));
    action11.addDataPredecessor(action6);
    action11.selectExecution(drs1, (FakeImplementation) action11.getImplementations()[0]);
    pendingActions.add(action11);
    FakeAllocatableAction action12 = new FakeAllocatableAction(fao, 12, 0, CoreManager.getCoreImplementations(4));
    action12.addDataPredecessor(action5);
    action12.addDataPredecessor(action6);
    action12.selectExecution(drs1, (FakeImplementation) action12.getImplementations()[0]);
    pendingActions.add(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);
    drs1.classifyPendingSchedulings(pendingActions, readyActions, selectableActions, new LinkedList<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>>());
    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<FakeProfile, FakeResourceDescription, FakeImplementation>(selectableActions), expectedSelectable);
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) HashMap(java.util.HashMap) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) AllocatableAction(es.bsc.es.bsc.compss.scheduler.types.AllocatableAction) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) PriorityQueue(java.util.PriorityQueue) PriorityActionSet(es.bsc.es.bsc.compss.scheduler.types.PriorityActionSet) LinkedList(java.util.LinkedList) BlockedActionException(es.bsc.es.bsc.compss.scheduler.exceptions.BlockedActionException) InvalidSchedulingException(es.bsc.es.bsc.compss.scheduler.exceptions.InvalidSchedulingException) UnassignedActionException(es.bsc.es.bsc.compss.scheduler.exceptions.UnassignedActionException) FullGraphSchedulingInformation(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphSchedulingInformation) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction)

Example 4 with FakeResourceDescription

use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription in project compss by bsc-wdc.

the class ScoresTest method testImplementationScores.

@SuppressWarnings("unchecked")
@Test
public void testImplementationScores() throws BlockedActionException, UnassignedActionException {
    drs1.clear();
    // No resources and no dependencies
    FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(4));
    TaskDescription tp1 = new TaskDescription("task", false, Constants.SINGLE_NODE, false, false, false, false, new Parameter[0]);
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
    Verifiers.verifyScore(score1, 0, 0, 0, 0, 0);
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 0, 0, CORE4_0, 0);
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 0, 0, CORE4_1, 0);
    Verifiers.validateBetterScore(score1_0, score1_1, true);
    // Resources with load
    FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
    action2.selectExecution(drs1, (FakeImplementation) action2.getImplementations()[0]);
    drs1.scheduleAction(action2);
    score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 0, CORE0, CORE4_0, CORE0);
    score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 0, 0, CORE4_1, 0);
    Verifiers.validateBetterScore(score1_0, score1_1, false);
    FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 0, CoreManager.getCoreImplementations(2));
    action3.selectExecution(drs1, (FakeImplementation) action3.getImplementations()[0]);
    drs1.scheduleAction(action3);
    score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 0, CORE0, CORE4_0, CORE0);
    score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 0, CORE2, CORE4_1, CORE2);
    Verifiers.validateBetterScore(score1_0, score1_1, false);
    // Data Dependencies
    FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(0));
    action10.selectExecution(drs2, (FakeImplementation) action10.getImplementations()[0]);
    FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi10 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action10.getSchedulingInfo();
    dsi10.setExpectedEnd(10);
    action1.addDataPredecessor(action10);
    score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
    Verifiers.verifyScore(score1, 0, 10, 0, 0, 10);
    score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 10, CORE0, CORE4_0, CORE0);
    score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 10, CORE2, CORE4_1, CORE2);
    Verifiers.validateBetterScore(score1_0, score1_1, false);
    FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(0));
    action11.selectExecution(drs2, (FakeImplementation) action11.getImplementations()[0]);
    FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi11 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action11.getSchedulingInfo();
    dsi11.setExpectedEnd(10_000);
    action1.addDataPredecessor(action11);
    score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
    Verifiers.verifyScore(score1, 0, 10_000, 0, 0, 10_000);
    score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 10_000, CORE0, CORE4_0, 10_000);
    score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 10_000, CORE2, CORE4_1, 10_000);
    Verifiers.validateBetterScore(score1_0, score1_1, true);
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FullGraphScore(es.bsc.es.bsc.compss.scheduler.types.FullGraphScore) FullGraphSchedulingInformation(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphSchedulingInformation) TaskDescription(es.bsc.compss.types.TaskDescription) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) Test(org.junit.Test)

Example 5 with FakeResourceDescription

use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription in project compss by bsc-wdc.

the class ScoresTest method testResourceScores.

@SuppressWarnings("unchecked")
@Test
public void testResourceScores() throws BlockedActionException, UnassignedActionException, Exception {
    drs1.clear();
    FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
    DataInstanceId d1v1 = new DataInstanceId(1, 1);
    Comm.registerData(d1v1.getRenaming());
    DataInstanceId d2v2 = new DataInstanceId(2, 2);
    Comm.registerData(d2v2.getRenaming());
    DependencyParameter dpD1V1 = new DependencyParameter(DataType.FILE_T, Direction.IN, Stream.UNSPECIFIED, Constants.PREFIX_EMTPY);
    dpD1V1.setDataAccessId(new RAccessId(1, 1));
    DependencyParameter dpD2V2 = new DependencyParameter(DataType.FILE_T, Direction.IN, Stream.UNSPECIFIED, Constants.PREFIX_EMTPY);
    dpD2V2.setDataAccessId(new RAccessId(2, 2));
    TaskDescription params = new TaskDescription("task", false, Constants.SINGLE_NODE, false, false, false, false, new Parameter[] { dpD1V1, dpD2V2 });
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> actionScore = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
    Verifiers.verifyScore(score1, 0, 2 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 2 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
    Comm.registerLocation(d1v1.getRenaming(), DataLocation.createLocation(drs1.getResource(), new SimpleURI("/home/test/a")));
    score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
    Verifiers.verifyScore(score1, 0, 1 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 1 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
    Comm.registerLocation(d2v2.getRenaming(), DataLocation.createLocation(drs1.getResource(), new SimpleURI("/home/test/b")));
    score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
    Verifiers.verifyScore(score1, 0, 0 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 0 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
    Comm.removeData(d1v1.getRenaming());
    Comm.removeData(d2v2.getRenaming());
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) DataInstanceId(es.bsc.compss.types.data.DataInstanceId) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FullGraphScore(es.bsc.es.bsc.compss.scheduler.types.FullGraphScore) RAccessId(es.bsc.compss.types.data.DataAccessId.RAccessId) TaskDescription(es.bsc.compss.types.TaskDescription) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) SimpleURI(es.bsc.compss.types.uri.SimpleURI) DependencyParameter(es.bsc.compss.types.parameter.DependencyParameter) Test(org.junit.Test)

Aggregations

FakeResourceDescription (es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription)15 FakeImplementation (es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation)14 FakeProfile (es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile)13 FakeAllocatableAction (es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction)9 LinkedList (java.util.LinkedList)8 FullGraphSchedulingInformation (es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphSchedulingInformation)7 AllocatableAction (es.bsc.es.bsc.compss.scheduler.types.AllocatableAction)5 PriorityActionSet (es.bsc.es.bsc.compss.scheduler.types.PriorityActionSet)5 Test (org.junit.Test)5 Implementation (es.bsc.compss.types.implementations.Implementation)4 BlockedActionException (es.bsc.es.bsc.compss.scheduler.exceptions.BlockedActionException)4 InvalidSchedulingException (es.bsc.es.bsc.compss.scheduler.exceptions.InvalidSchedulingException)4 UnassignedActionException (es.bsc.es.bsc.compss.scheduler.exceptions.UnassignedActionException)4 FakeResourceScheduler (es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceScheduler)4 FakeWorker (es.bsc.es.bsc.compss.scheduler.types.fake.FakeWorker)4 PriorityQueue (java.util.PriorityQueue)4 BeforeClass (org.junit.BeforeClass)4 FullGraphScore (es.bsc.es.bsc.compss.scheduler.types.FullGraphScore)3 HashMap (java.util.HashMap)3 TaskDescription (es.bsc.compss.types.TaskDescription)2