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