Search in sources :

Example 1 with FakeAllocatableAction

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

the class AllocatableActionTest method testEndDataAndResourcesPredecessors.

private void testEndDataAndResourcesPredecessors() {
    LOGGER.info("testEndTwoPredecessors");
    try {
        prepare(4);
        FakeAllocatableAction instance0 = new FakeAllocatableAction(fao, 0);
        instance0.assignResource(rs);
        FakeAllocatableAction instance1 = new FakeAllocatableAction(fao, 1);
        instance1.assignResource(rs);
        FakeAllocatableAction instance2 = new FakeAllocatableAction(fao, 2);
        instance2.assignResource(rs);
        FakeAllocatableAction instance3 = new FakeAllocatableAction(fao, 3);
        instance3.assignResource(rs);
        instance2.addDataPredecessor(instance0);
        addResourceDependency(instance1, instance2);
        instance0.tryToLaunch();
        completed(instance0);
        checkExecutions(new int[] { 1, 0, 0, 0 });
        instance1.tryToLaunch();
        completed(instance1);
        checkExecutions(new int[] { 1, 1, 1, 0 });
    } catch (Throwable e) {
        LOGGER.error(e);
        fail(e.getMessage());
    }
}
Also used : FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction)

Example 2 with FakeAllocatableAction

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

the class AllocatableActionTest method testBasicFailDependencies.

private void testBasicFailDependencies() {
    LOGGER.info("testBasicFailDependencies");
    try {
        prepare(4);
        FakeAllocatableAction instance0 = new FakeAllocatableAction(fao, 0);
        instance0.assignResource(rs);
        FakeAllocatableAction instance1 = new FakeAllocatableAction(fao, 1);
        instance1.assignResource(rs);
        FakeAllocatableAction instance2 = new FakeAllocatableAction(fao, 2);
        instance2.assignResource(rs);
        FakeAllocatableAction instance3 = new FakeAllocatableAction(fao, 3);
        instance3.assignResource(rs);
        instance2.addDataPredecessor(instance0);
        addResourceDependency(instance0, instance1);
        addResourceDependency(instance1, instance2);
        addResourceDependency(instance2, instance3);
        instance0.tryToLaunch();
        checkExecutions(new int[] { 1, 0, 0, 0 });
        checkErrors(new int[] { 0, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0 });
        error(instance0);
        checkExecutions(new int[] { 1, 1, 0, 0 });
        checkErrors(new int[] { 1, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0 });
        instance0.assignResource(rs);
        instance0.tryToLaunch();
        checkExecutions(new int[] { 2, 1, 0, 0 });
        checkErrors(new int[] { 1, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0 });
        error(instance0);
        checkExecutions(new int[] { 2, 1, 0, 0 });
        checkErrors(new int[] { 2, 0, 0, 0 });
        checkFailed(new int[] { 1, 0, 1, 0 });
        completed(instance1);
        checkExecutions(new int[] { 2, 1, 0, 1 });
        checkErrors(new int[] { 2, 0, 0, 0 });
        checkFailed(new int[] { 1, 0, 1, 0 });
    } catch (Throwable e) {
        LOGGER.error(e);
        fail(e.getMessage());
    }
}
Also used : FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction)

Example 3 with FakeAllocatableAction

use of es.bsc.compss.types.fake.FakeAllocatableAction 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 4 with FakeAllocatableAction

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

the class AllocatableActionTest method testBasicErrorDependencies.

private void testBasicErrorDependencies() {
    LOGGER.info("testBasicErrorDependencies");
    try {
        prepare(4);
        FakeAllocatableAction instance0 = new FakeAllocatableAction(fao, 0);
        instance0.assignResource(rs);
        FakeAllocatableAction instance1 = new FakeAllocatableAction(fao, 1);
        instance1.assignResource(rs);
        FakeAllocatableAction instance2 = new FakeAllocatableAction(fao, 2);
        instance2.assignResource(rs);
        FakeAllocatableAction instance3 = new FakeAllocatableAction(fao, 3);
        instance3.assignResource(rs);
        instance1.addDataPredecessor(instance0);
        instance2.addDataPredecessor(instance0);
        addResourceDependency(instance0, instance1);
        addResourceDependency(instance0, instance2);
        addResourceDependency(instance0, instance3);
        instance0.tryToLaunch();
        checkExecutions(new int[] { 1, 0, 0, 0 });
        checkErrors(new int[] { 0, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0 });
        error(instance0);
        checkExecutions(new int[] { 1, 0, 0, 1 });
        checkErrors(new int[] { 1, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0 });
        instance0.assignResource(rs);
        addResourceDependency(instance3, instance0);
        completed(instance3);
        checkExecutions(new int[] { 2, 0, 0, 1 });
        checkErrors(new int[] { 1, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0 });
        completed(instance0);
        checkExecutions(new int[] { 2, 1, 1, 1 });
        checkErrors(new int[] { 1, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0 });
    } catch (Throwable e) {
        LOGGER.error(e);
        fail(e.getMessage());
    }
}
Also used : FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction)

Example 5 with FakeAllocatableAction

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

the class AllocatableActionTest method testFailDependencies.

private void testFailDependencies() {
    LOGGER.info("testFailDependencies");
    try {
        prepare(6);
        /*
             * Data dependencies: 1-->4 Graph execution 2 5 / \ / 1~~~4 \ / \ 3 6
             */
        FakeAllocatableAction instance0 = new FakeAllocatableAction(fao, 0);
        instance0.assignResource(rs);
        FakeAllocatableAction instance1 = new FakeAllocatableAction(fao, 1);
        instance1.assignResource(rs);
        FakeAllocatableAction instance2 = new FakeAllocatableAction(fao, 2);
        instance2.assignResource(rs);
        FakeAllocatableAction instance3 = new FakeAllocatableAction(fao, 3);
        instance3.assignResource(rs);
        FakeAllocatableAction instance4 = new FakeAllocatableAction(fao, 4);
        instance4.assignResource(rs);
        FakeAllocatableAction instance5 = new FakeAllocatableAction(fao, 5);
        instance5.assignResource(rs);
        instance3.addDataPredecessor(instance0);
        addResourceDependency(instance0, instance1);
        addResourceDependency(instance0, instance2);
        addResourceDependency(instance1, instance3);
        addResourceDependency(instance2, instance3);
        addResourceDependency(instance3, instance4);
        addResourceDependency(instance3, instance5);
        instance0.tryToLaunch();
        checkExecutions(new int[] { 1, 0, 0, 0, 0, 0 });
        checkErrors(new int[] { 0, 0, 0, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0, 0, 0 });
        error(instance0);
        checkExecutions(new int[] { 1, 1, 1, 0, 0, 0 });
        checkErrors(new int[] { 1, 0, 0, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0, 0, 0 });
        instance0.assignResource(rs);
        instance0.tryToLaunch();
        checkExecutions(new int[] { 2, 1, 1, 0, 0, 0 });
        checkErrors(new int[] { 1, 0, 0, 0, 0, 0 });
        checkFailed(new int[] { 0, 0, 0, 0, 0, 0 });
        error(instance0);
        checkExecutions(new int[] { 2, 1, 1, 0, 0, 0 });
        checkErrors(new int[] { 2, 0, 0, 0, 0, 0 });
        checkFailed(new int[] { 1, 0, 0, 1, 0, 0 });
        completed(instance1);
        checkExecutions(new int[] { 2, 1, 1, 0, 0, 0 });
        checkErrors(new int[] { 2, 0, 0, 0, 0, 0 });
        checkFailed(new int[] { 1, 0, 0, 1, 0, 0 });
        completed(instance2);
        checkExecutions(new int[] { 2, 1, 1, 0, 1, 1 });
        checkErrors(new int[] { 2, 0, 0, 0, 0, 0 });
        checkFailed(new int[] { 1, 0, 0, 1, 0, 0 });
    } catch (Throwable e) {
        LOGGER.error(e);
        fail(e.getMessage());
    }
}
Also used : FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction)

Aggregations

FakeAllocatableAction (es.bsc.compss.types.fake.FakeAllocatableAction)20 FailedActionException (es.bsc.compss.scheduler.exceptions.FailedActionException)2 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)2 FakeResourceScheduler (es.bsc.compss.types.fake.FakeResourceScheduler)2 BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)1 InvalidSchedulingException (es.bsc.compss.scheduler.exceptions.InvalidSchedulingException)1 UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Test (org.junit.Test)1