Search in sources :

Example 11 with Score

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);
}
Also used : Score(es.bsc.compss.scheduler.types.Score) UnassignedActionException(es.bsc.compss.scheduler.exceptions.UnassignedActionException) Implementation(es.bsc.compss.types.implementations.Implementation)

Example 12 with Score

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);
        }
    }
}
Also used : Score(es.bsc.compss.scheduler.types.Score) ObjectValue(es.bsc.compss.scheduler.types.ObjectValue) BlockedActionException(es.bsc.compss.scheduler.exceptions.BlockedActionException) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) PriorityQueue(java.util.PriorityQueue)

Aggregations

Score (es.bsc.compss.scheduler.types.Score)12 BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)9 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)7 UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)4 ObjectValue (es.bsc.compss.scheduler.types.ObjectValue)4 PriorityQueue (java.util.PriorityQueue)4 ActionNotFoundException (es.bsc.compss.scheduler.exceptions.ActionNotFoundException)3 MOScore (es.bsc.compss.scheduler.multiobjective.types.MOScore)3 Implementation (es.bsc.compss.types.implementations.Implementation)3 InvalidSchedulingException (es.bsc.compss.scheduler.exceptions.InvalidSchedulingException)2 FailedActionException (es.bsc.compss.scheduler.exceptions.FailedActionException)1 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1 LinkedList (java.util.LinkedList)1