use of es.bsc.compss.types.fake.FakeAllocatableAction in project compss by bsc-wdc.
the class AllocatableActionTest method testExecute.
/**
* Test of execute method, of class AllocatableAction.
*/
@Test
public void testExecute() throws BlockedActionException, UnassignedActionException, InvalidSchedulingException {
// Create one instance
prepare(1);
FakeAllocatableAction instance = new FakeAllocatableAction(fao, 0);
// Run it
instance.assignResource(rs);
instance.tryToLaunch();
// Check if it was executed
checkExecutions(new int[] { 1 });
}
use of es.bsc.compss.types.fake.FakeAllocatableAction in project compss by bsc-wdc.
the class AllocatableActionTest method testEndResourcesAndPredecessors.
private void testEndResourcesAndPredecessors() {
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);
addResourceDependency(instance0, instance2);
instance2.addDataPredecessor(instance1);
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 testComplexGraph.
private void testComplexGraph() {
LOGGER.info("testComplexGraph");
/*
* Data dependency Graph
*
* 1 2 3 \ | / \|/ 4 /\ / \ 5 6 | 7
*/
try {
prepare(7);
FakeAllocatableAction task1 = new FakeAllocatableAction(fao, 0);
task1.assignResource(rs);
FakeAllocatableAction task2 = new FakeAllocatableAction(fao, 1);
task2.assignResource(rs);
FakeAllocatableAction task3 = new FakeAllocatableAction(fao, 2);
task3.assignResource(rs);
FakeAllocatableAction task4 = new FakeAllocatableAction(fao, 3);
task4.assignResource(rs);
task4.addDataPredecessor(task1);
task4.addDataPredecessor(task2);
task4.addDataPredecessor(task3);
FakeAllocatableAction task5 = new FakeAllocatableAction(fao, 4);
task5.assignResource(rs);
task5.addDataPredecessor(task4);
FakeAllocatableAction task6 = new FakeAllocatableAction(fao, 5);
task6.assignResource(rs);
task6.addDataPredecessor(task4);
FakeAllocatableAction task7 = new FakeAllocatableAction(fao, 6);
task7.assignResource(rs);
task7.addDataPredecessor(task4);
/*
* Scheduling Resource 1 executes 1, 3, 4 and 5 Resource 2 executes 2, 6 and 7
*/
// Resource 1
addResourceDependency(task1, task3);
addResourceDependency(task3, task4);
addResourceDependency(task4, task5);
// Resource 2
addResourceDependency(task2, task6);
addResourceDependency(task6, task7);
task1.tryToLaunch();
task2.tryToLaunch();
checkExecutions(new int[] { 1, 1, 0, 0, 0, 0, 0 });
completed(task1);
checkExecutions(new int[] { 1, 1, 1, 0, 0, 0, 0 });
completed(task2);
checkExecutions(new int[] { 1, 1, 1, 0, 0, 0, 0 });
completed(task3);
checkExecutions(new int[] { 1, 1, 1, 1, 0, 0, 0 });
completed(task4);
checkExecutions(new int[] { 1, 1, 1, 1, 1, 1, 0 });
completed(task5);
checkExecutions(new int[] { 1, 1, 1, 1, 1, 1, 0 });
completed(task6);
checkExecutions(new int[] { 1, 1, 1, 1, 1, 1, 1 });
completed(task7);
checkExecutions(new int[] { 1, 1, 1, 1, 1, 1, 1 });
} 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 testEndNoSuccessors.
private void testEndNoSuccessors() {
LOGGER.info("testEndNoSuccessors");
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);
instance0.tryToLaunch();
completed(instance0);
checkExecutions(new int[] { 1, 0, 0, 0 });
} catch (Exception 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 testEndTwoDataPredecessors.
private void testEndTwoDataPredecessors() {
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);
instance2.addDataPredecessor(instance1);
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());
}
}
Aggregations