use of es.bsc.compss.scheduler.types.Score in project compss by bsc-wdc.
the class ExecutionAction method schedule.
@Override
public final <T extends WorkerResourceDescription> void schedule(ResourceScheduler<T> targetWorker, Score actionScore) throws BlockedActionException, UnassignedActionException {
if (targetWorker == null || // Resource is not compatible with the Core
!targetWorker.getResource().canRun(task.getTaskDescription().getId()) || // already ran on the resource
this.getExecutingResources().contains(targetWorker)) {
String message = "Worker " + (targetWorker == null ? "null" : targetWorker.getName()) + " has not available resources to run " + this;
LOGGER.warn(message);
throw new UnassignedActionException();
}
Implementation bestImpl = null;
Score bestScore = null;
Score resourceScore = targetWorker.generateResourceScore(this, task.getTaskDescription(), actionScore);
for (Implementation impl : getCompatibleImplementations(targetWorker)) {
Score implScore = targetWorker.generateImplementationScore(this, task.getTaskDescription(), impl, resourceScore);
if (Score.isBetter(implScore, bestScore)) {
bestImpl = impl;
bestScore = implScore;
}
}
schedule(targetWorker, bestImpl);
}
use of es.bsc.compss.scheduler.types.Score in project compss by bsc-wdc.
the class ReadyScheduler method tryToLaunchFreeActions.
private <T extends WorkerResourceDescription> void tryToLaunchFreeActions(List<AllocatableAction> dataFreeActions, List<AllocatableAction> resourceFreeActions, List<AllocatableAction> blockedCandidates, ResourceScheduler<T> resource) {
// Try to launch all the data free actions and the resource free actions
PriorityQueue<ObjectValue<AllocatableAction>> executableActions = new PriorityQueue<>();
for (AllocatableAction freeAction : dataFreeActions) {
Score actionScore = generateActionScore(freeAction);
Score fullScore = freeAction.schedulingScore(resource, actionScore);
ObjectValue<AllocatableAction> obj = new ObjectValue<>(freeAction, fullScore);
executableActions.add(obj);
}
for (AllocatableAction freeAction : resourceFreeActions) {
Score actionScore = generateActionScore(freeAction);
Score fullScore = freeAction.schedulingScore(resource, actionScore);
ObjectValue<AllocatableAction> obj = new ObjectValue<>(freeAction, fullScore);
if (!executableActions.contains(obj)) {
executableActions.add(obj);
}
}
while (!executableActions.isEmpty()) {
ObjectValue<AllocatableAction> obj = executableActions.poll();
AllocatableAction freeAction = obj.getObject();
// LOGGER.debug("Trying to launch action " + freeAction);
try {
scheduleAction(freeAction, obj.getScore());
tryToLaunch(freeAction);
} catch (BlockedActionException e) {
removeFromReady(freeAction);
addToBlocked(freeAction);
}
}
}
Aggregations