Search in sources :

Example 6 with BlockedActionException

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

the class TaskScheduler method reducedWorkerResources.

@SuppressWarnings("unchecked")
private <T extends WorkerResourceDescription> void reducedWorkerResources(ResourceScheduler<T> worker, ResourceUpdate<T> modification) {
    CloudMethodWorker cloudWorker = (CloudMethodWorker) worker.getResource();
    if (!cloudWorker.getDescription().getTypeComposition().isEmpty()) {
        synchronized (workers) {
            workers.remove(((ResourceScheduler<WorkerResourceDescription>) worker).getResource());
            int coreCount = CoreManager.getCoreCount();
            List<Implementation>[] runningCoreImpls = worker.getExecutableImpls();
            for (int coreId = 0; coreId < coreCount; coreId++) {
                for (Implementation impl : runningCoreImpls[coreId]) {
                    Profile p = worker.getProfile(impl);
                    if (p != null) {
                        offVMsProfiles[coreId][impl.getImplementationId()].accumulate(p);
                    }
                }
            }
        }
        this.workerRemoved((ResourceScheduler<WorkerResourceDescription>) worker);
        StopWorkerAction action = new StopWorkerAction(generateSchedulingInformation(worker), worker, this, modification);
        try {
            action.schedule((ResourceScheduler<WorkerResourceDescription>) worker, (Score) null);
            action.tryToLaunch();
        } catch (BlockedActionException | UnassignedActionException | InvalidSchedulingException e) {
        // Can not be blocked nor unassigned
        }
    } else {
        ResourceManager.terminateCloudResource(cloudWorker, (CloudMethodResourceDescription) modification.getModification());
    }
}
Also used : UnassignedActionException(es.bsc.compss.scheduler.exceptions.UnassignedActionException) CloudMethodWorker(es.bsc.compss.types.resources.CloudMethodWorker) BlockedActionException(es.bsc.compss.scheduler.exceptions.BlockedActionException) WorkerResourceDescription(es.bsc.compss.types.resources.WorkerResourceDescription) InvalidSchedulingException(es.bsc.compss.scheduler.exceptions.InvalidSchedulingException) LinkedList(java.util.LinkedList) List(java.util.List) StopWorkerAction(es.bsc.compss.scheduler.types.allocatableactions.StopWorkerAction) Implementation(es.bsc.compss.types.implementations.Implementation) Profile(es.bsc.compss.scheduler.types.Profile)

Example 7 with BlockedActionException

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

the class TaskScheduler method increasedWorkerResources.

private <T extends WorkerResourceDescription> void increasedWorkerResources(ResourceScheduler<T> worker, ResourceUpdate<T> modification) {
    if (worker.getExecutableCores().isEmpty()) {
    // We no longer remove workers with empty executable cores since new core elements
    // can be registered on execution time
    } else {
        // Inspect blocked actions to be freed
        List<AllocatableAction> compatibleActions = this.blockedActions.removeAllCompatibleActions(worker.getResource());
        // Prioritize them
        PriorityQueue<ObjectValue<AllocatableAction>> sortedCompatibleActions = new PriorityQueue<>();
        for (AllocatableAction action : compatibleActions) {
            ObjectValue<AllocatableAction> obj = new ObjectValue<>(action, generateActionScore(action));
            sortedCompatibleActions.add(obj);
        }
        // Schedule them
        while (!sortedCompatibleActions.isEmpty()) {
            ObjectValue<AllocatableAction> obj = sortedCompatibleActions.poll();
            Score actionScore = obj.getScore();
            AllocatableAction action = obj.getObject();
            if (!action.hasDataPredecessors()) {
                addToReady(action);
            }
            try {
                scheduleAction(action, actionScore);
                tryToLaunch(action);
            } catch (BlockedActionException bae) {
                removeFromReady(action);
                addToBlocked(action);
            }
        }
        // Update worker load
        this.workerLoadUpdate(worker);
    }
}
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)

Example 8 with BlockedActionException

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

the class TaskScheduler method newAllocatableAction.

/*
     * *********************************************************************************************************
     * *********************************************************************************************************
     * ********************************* SCHEDULING OPERATIONS *************************************************
     * *********************************************************************************************************
     * *********************************************************************************************************
     */
/**
 * Introduces a new action in the Scheduler system. The method should place the action in a resource hurriedly
 *
 * @param action
 *            Action to be scheduled.
 */
public final void newAllocatableAction(AllocatableAction action) {
    LOGGER.info("[TaskScheduler] Registering new AllocatableAction " + action);
    if (!action.hasDataPredecessors()) {
        addToReady(action);
    }
    Score actionScore = generateActionScore(action);
    try {
        scheduleAction(action, actionScore);
        tryToLaunch(action);
    } catch (BlockedActionException bae) {
        removeFromReady(action);
        addToBlocked(action);
    }
}
Also used : Score(es.bsc.compss.scheduler.types.Score) BlockedActionException(es.bsc.compss.scheduler.exceptions.BlockedActionException)

Example 9 with BlockedActionException

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

the class MOScheduleOptimizer method scheduleOnWorker.

public void scheduleOnWorker(AllocatableAction action, Implementation impl, OptimizationWorker ow) {
    boolean failedSpecificScheduling = false;
    try {
        action.schedule(ow.getResource(), impl);
        try {
            action.tryToLaunch();
        } catch (InvalidSchedulingException ise) {
            failedSpecificScheduling = true;
        }
    } catch (BlockedActionException bae) {
    // Can not happen since there was an original source
    } catch (UnassignedActionException be) {
        failedSpecificScheduling = true;
    }
    if (failedSpecificScheduling) {
        try {
            long actionScore = MOScore.getActionScore(action);
            long dataTime = MOScore.getDataPredecessorTime(action.getDataPredecessors());
            Score aScore = new MOScore(actionScore, dataTime, 0, 0, 0, 0);
            action.schedule(aScore);
            try {
                action.tryToLaunch();
            } catch (InvalidSchedulingException ise2) {
            // Impossible exception if schedule method on action is ok.
            }
        } catch (BlockedActionException | UnassignedActionException be) {
        // Can not happen since there was an original source
        }
    }
}
Also used : MOScore(es.bsc.compss.scheduler.multiobjective.types.MOScore) Score(es.bsc.compss.scheduler.types.Score) UnassignedActionException(es.bsc.compss.scheduler.exceptions.UnassignedActionException) BlockedActionException(es.bsc.compss.scheduler.exceptions.BlockedActionException) InvalidSchedulingException(es.bsc.compss.scheduler.exceptions.InvalidSchedulingException) MOScore(es.bsc.compss.scheduler.multiobjective.types.MOScore)

Example 10 with BlockedActionException

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

Aggregations

BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)12 Score (es.bsc.compss.scheduler.types.Score)9 UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)6 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)6 InvalidSchedulingException (es.bsc.compss.scheduler.exceptions.InvalidSchedulingException)4 ObjectValue (es.bsc.compss.scheduler.types.ObjectValue)3 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)3 LinkedList (java.util.LinkedList)3 PriorityQueue (java.util.PriorityQueue)3 ActionNotFoundException (es.bsc.compss.scheduler.exceptions.ActionNotFoundException)2 MOScore (es.bsc.compss.scheduler.multiobjective.types.MOScore)2 Implementation (es.bsc.compss.types.implementations.Implementation)2 List (java.util.List)2 ResourceScheduler (es.bsc.compss.components.impl.ResourceScheduler)1 FailedActionException (es.bsc.compss.scheduler.exceptions.FailedActionException)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