Search in sources :

Example 1 with FakeResourceScheduler

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

the class AllocatableActionTest method completed.

/*---------------------------------------------------------
     ----------------------------------------------------------
     --------------------- SCHEDULER ACTIONS ------------------
     ----------------------------------------------------------
     --------------------------------------------------------*/
public void completed(FakeAllocatableAction action) throws BlockedActionException, UnassignedActionException, InvalidSchedulingException {
    FakeResourceScheduler resource = (FakeResourceScheduler) action.getAssignedResource();
    List<AllocatableAction> dataFree = action.completed();
    List<AllocatableAction> resourceFree = resource.unscheduleAction(action);
    Set<AllocatableAction> freeTasks = new HashSet<>();
    freeTasks.addAll(dataFree);
    freeTasks.addAll(resourceFree);
    for (AllocatableAction a : freeTasks) {
        FakeAllocatableAction fa = (FakeAllocatableAction) a;
        fa.tryToLaunch();
    }
}
Also used : FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction) FakeResourceScheduler(es.bsc.compss.types.fake.FakeResourceScheduler) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction) HashSet(java.util.HashSet)

Example 2 with FakeResourceScheduler

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

the class AllocatableActionTest method setUpClass.

@BeforeClass
public static void setUpClass() {
    ResourceManager.clear(rus);
    // Method resource description and its slots
    int maxSlots = 3;
    Processor p = new Processor();
    p.setComputingUnits(maxSlots);
    description = new MethodResourceDescription();
    description.addProcessor(p);
    // Task Scheduler
    ts = new TaskScheduler();
    // Task Dispatcher
    fao = new FakeActionOrchestrator(ts);
    ts.setOrchestrator(fao);
    // Resource Scheduler
    rs = new FakeResourceScheduler(new FakeWorker(description, maxSlots), null, null);
}
Also used : FakeActionOrchestrator(es.bsc.compss.types.fake.FakeActionOrchestrator) Processor(es.bsc.compss.types.resources.components.Processor) FakeResourceScheduler(es.bsc.compss.types.fake.FakeResourceScheduler) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) TaskScheduler(es.bsc.compss.components.impl.TaskScheduler) FakeWorker(es.bsc.compss.types.fake.FakeWorker) BeforeClass(org.junit.BeforeClass)

Example 3 with FakeResourceScheduler

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

the class AllocatableActionTest method error.

public void error(FakeAllocatableAction action) throws BlockedActionException, UnassignedActionException, InvalidSchedulingException {
    FakeResourceScheduler resource = (FakeResourceScheduler) action.getAssignedResource();
    List<AllocatableAction> resourceFree;
    try {
        action.error();
        resourceFree = resource.unscheduleAction(action);
    } catch (FailedActionException fae) {
        resourceFree = new LinkedList<>();
        for (AllocatableAction failed : action.failed()) {
            resourceFree.addAll(resource.unscheduleAction(failed));
        }
    }
    for (AllocatableAction a : resourceFree) {
        FakeAllocatableAction fa = (FakeAllocatableAction) a;
        fa.tryToLaunch();
    }
}
Also used : FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction) FakeResourceScheduler(es.bsc.compss.types.fake.FakeResourceScheduler) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction) FailedActionException(es.bsc.compss.scheduler.exceptions.FailedActionException) LinkedList(java.util.LinkedList)

Aggregations

FakeResourceScheduler (es.bsc.compss.types.fake.FakeResourceScheduler)3 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)2 FakeAllocatableAction (es.bsc.compss.types.fake.FakeAllocatableAction)2 TaskScheduler (es.bsc.compss.components.impl.TaskScheduler)1 FailedActionException (es.bsc.compss.scheduler.exceptions.FailedActionException)1 FakeActionOrchestrator (es.bsc.compss.types.fake.FakeActionOrchestrator)1 FakeWorker (es.bsc.compss.types.fake.FakeWorker)1 MethodResourceDescription (es.bsc.compss.types.resources.MethodResourceDescription)1 Processor (es.bsc.compss.types.resources.components.Processor)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 BeforeClass (org.junit.BeforeClass)1