use of es.bsc.compss.scheduler.exceptions.FailedActionException in project compss by bsc-wdc.
the class TaskScheduler method errorOnAction.
/**
* Registers an error on the action given as a parameter. The action itself processes the error and triggers with
* any possible solution to re-execute it. This code is executed only on re-schedule (no resubmit)
*
* @param action
* action raising the error
*/
@SuppressWarnings("unchecked")
public final void errorOnAction(AllocatableAction action) {
LOGGER.warn("[TaskScheduler] Error on action " + action);
List<AllocatableAction> resourceFree = new LinkedList<>();
ResourceScheduler<WorkerResourceDescription> resource = (ResourceScheduler<WorkerResourceDescription>) action.getAssignedResource();
boolean failed = false;
// Process the action error (removes the assigned resource)
try {
action.error();
} catch (FailedActionException fae) {
// Action has completely failed
failed = true;
LOGGER.warn("[TaskScheduler] Action completely failed " + action);
removeFromReady(action);
// Free all the dependent tasks
for (AllocatableAction failedAction : action.failed()) {
try {
resourceFree.addAll(resource.unscheduleAction(failedAction));
} catch (ActionNotFoundException anfe) {
// Once the action starts running should cannot be moved from the resource
}
}
}
// We free the current task and get the free actions from the resource
try {
resourceFree.addAll(resource.unscheduleAction(action));
} catch (ActionNotFoundException anfe) {
// Once the action starts running should cannot be moved from the resource
}
workerLoadUpdate(resource);
if (!failed) {
// Try to re-schedule the action
Score actionScore = generateActionScore(action);
try {
scheduleAction(action, actionScore);
tryToLaunch(action);
} catch (BlockedActionException bae) {
removeFromReady(action);
addToBlocked(action);
}
}
List<AllocatableAction> blockedCandidates = new LinkedList<>();
handleDependencyFreeActions(new LinkedList<>(), resourceFree, blockedCandidates, resource);
for (AllocatableAction aa : blockedCandidates) {
removeFromReady(aa);
addToBlocked(aa);
}
}
use of es.bsc.compss.scheduler.exceptions.FailedActionException 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