Search in sources :

Example 6 with UnassignedActionException

use of es.bsc.compss.scheduler.exceptions.UnassignedActionException in project compss by bsc-wdc.

the class TaskScheduler method reduceWorkerResources.

private <T extends WorkerResourceDescription> void reduceWorkerResources(ResourceScheduler<T> worker, ResourceUpdate<T> modification) {
    worker.pendingModification(modification);
    SchedulingInformation schedInfo = generateSchedulingInformation(worker);
    ReduceWorkerAction<T> action = new ReduceWorkerAction<>(schedInfo, worker, this, modification);
    try {
        action.schedule(worker, (Score) null);
        action.tryToLaunch();
    } catch (BlockedActionException | UnassignedActionException | InvalidSchedulingException e) {
    // Can not be blocked nor unassigned
    }
}
Also used : UnassignedActionException(es.bsc.compss.scheduler.exceptions.UnassignedActionException) BlockedActionException(es.bsc.compss.scheduler.exceptions.BlockedActionException) InvalidSchedulingException(es.bsc.compss.scheduler.exceptions.InvalidSchedulingException) ReduceWorkerAction(es.bsc.compss.scheduler.types.allocatableactions.ReduceWorkerAction) SchedulingInformation(es.bsc.compss.scheduler.types.SchedulingInformation)

Example 7 with UnassignedActionException

use of es.bsc.compss.scheduler.exceptions.UnassignedActionException 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)

Aggregations

UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)7 BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)6 InvalidSchedulingException (es.bsc.compss.scheduler.exceptions.InvalidSchedulingException)4 Score (es.bsc.compss.scheduler.types.Score)4 MOScore (es.bsc.compss.scheduler.multiobjective.types.MOScore)2 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)2 Implementation (es.bsc.compss.types.implementations.Implementation)2 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 ResourceScheduler (es.bsc.compss.components.impl.ResourceScheduler)1 ObjectValue (es.bsc.compss.scheduler.types.ObjectValue)1 Profile (es.bsc.compss.scheduler.types.Profile)1 SchedulingInformation (es.bsc.compss.scheduler.types.SchedulingInformation)1 ReduceWorkerAction (es.bsc.compss.scheduler.types.allocatableactions.ReduceWorkerAction)1 StopWorkerAction (es.bsc.compss.scheduler.types.allocatableactions.StopWorkerAction)1 CloudMethodWorker (es.bsc.compss.types.resources.CloudMethodWorker)1 ArrayList (java.util.ArrayList)1 PriorityQueue (java.util.PriorityQueue)1