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());
}
}
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());
}
}
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());
}
}
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());
}
}
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();
}
}
Aggregations