Search in sources :

Example 16 with FakeAllocatableAction

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

the class AllocatableActionTest method testOneFail.

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

Example 17 with FakeAllocatableAction

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

the class AllocatableActionTest method testOneError.

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

Example 18 with FakeAllocatableAction

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

the class AllocatableActionTest method testEndDataSuccessors.

private void testEndDataSuccessors() {
    LOGGER.info("testEndDataSuccessors");
    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);
        instance0.tryToLaunch();
        completed(instance0);
        checkExecutions(new int[] { 1, 1, 0, 0 });
    } catch (Throwable e) {
        LOGGER.error(e);
        fail(e.getMessage());
    }
}
Also used : FakeAllocatableAction(es.bsc.compss.types.fake.FakeAllocatableAction)

Example 19 with FakeAllocatableAction

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

the class AllocatableActionTest method testEndDataAndResourceSuccessors.

private void testEndDataAndResourceSuccessors() {
    LOGGER.info("testEndDataAndResourceSuccessors");
    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);
        addResourceDependency(instance0, instance2);
        instance0.tryToLaunch();
        completed(instance0);
        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 20 with FakeAllocatableAction

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

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