Search in sources :

Example 1 with UnassignedActionException

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

the class MOResourceScheduler method tryToLaunch.

private boolean tryToLaunch(AllocatableAction action) {
    boolean launched = false;
    try {
        action.tryToLaunch();
        launched = true;
    } catch (InvalidSchedulingException ise) {
    }
    if (!launched) {
        long actionScore = MOScore.getActionScore(action);
        Score aScore = new MOScore(actionScore, 0, 0, 0, 0, 0);
        try {
            action.schedule(aScore);
            try {
                action.tryToLaunch();
            } catch (InvalidSchedulingException ise2) {
                // Impossible exception.
                LOGGER.error(ise2);
            }
        } catch (BlockedActionException | UnassignedActionException be) {
            // Can not happen since there was an original source
            LOGGER.error(be);
        }
    }
    return launched;
}
Also used : Score(es.bsc.compss.scheduler.types.Score) MOScore(es.bsc.compss.scheduler.multiobjective.types.MOScore) 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 2 with UnassignedActionException

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

the class FIFODataScheduler method purgeFreeActions.

/*
     * *********************************************************************************************************
     * *********************************************************************************************************
     * ********************************* SCHEDULING OPERATIONS *************************************************
     * *********************************************************************************************************
     * *********************************************************************************************************
     */
@Override
public <T extends WorkerResourceDescription> void purgeFreeActions(List<AllocatableAction> dataFreeActions, List<AllocatableAction> resourceFreeActions, List<AllocatableAction> blockedCandidates, ResourceScheduler<T> resource) {
    LOGGER.debug("[DataScheduler] Treating dependency free actions");
    PriorityQueue<ObjectValue<AllocatableAction>> executableActions = new PriorityQueue<>();
    for (AllocatableAction action : dataFreeActions) {
        Score actionScore = this.generateActionScore(action);
        Score fullScore = action.schedulingScore(resource, actionScore);
        ObjectValue<AllocatableAction> obj = new ObjectValue<>(action, fullScore);
        executableActions.add(obj);
    }
    dataFreeActions.clear();
    while (!executableActions.isEmpty()) {
        ObjectValue<AllocatableAction> obj = executableActions.poll();
        AllocatableAction freeAction = obj.getObject();
        try {
            scheduleAction(freeAction, resource, obj.getScore());
            tryToLaunch(freeAction);
        } catch (BlockedActionException e) {
            removeFromReady(freeAction);
            addToBlocked(freeAction);
        } catch (UnassignedActionException e) {
            dataFreeActions.add(freeAction);
        }
    }
    List<AllocatableAction> unassignedReadyActions = this.unassignedReadyActions.getAllActions();
    this.unassignedReadyActions.removeAllActions();
    dataFreeActions.addAll(unassignedReadyActions);
}
Also used : Score(es.bsc.compss.scheduler.types.Score) ObjectValue(es.bsc.compss.scheduler.types.ObjectValue) UnassignedActionException(es.bsc.compss.scheduler.exceptions.UnassignedActionException) BlockedActionException(es.bsc.compss.scheduler.exceptions.BlockedActionException) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) PriorityQueue(java.util.PriorityQueue)

Example 3 with UnassignedActionException

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

the class ExecutionAction method tryToSchedule.

@SuppressWarnings("unchecked")
@Override
public final void tryToSchedule(Score actionScore) throws BlockedActionException, UnassignedActionException {
    // COMPUTE RESOURCE CANDIDATES
    List<ResourceScheduler<? extends WorkerResourceDescription>> candidates = new LinkedList<>();
    if (this.isTargetResourceEnforced()) {
        // The scheduling is forced to a given resource
        candidates.add((ResourceScheduler<WorkerResourceDescription>) this.getEnforcedTargetResource());
    } else if (isSchedulingConstrained()) {
        // The scheduling is constrained by dependencies
        for (AllocatableAction a : this.getConstrainingPredecessors()) {
            candidates.add((ResourceScheduler<WorkerResourceDescription>) a.getAssignedResource());
        }
    } else {
        // Free scheduling
        List<ResourceScheduler<? extends WorkerResourceDescription>> compatibleCandidates = getCompatibleWorkers();
        if (compatibleCandidates.size() == 0) {
            throw new BlockedActionException();
        }
        for (ResourceScheduler<? extends WorkerResourceDescription> currentWorker : compatibleCandidates) {
            if (currentWorker.getResource().hasAvailableSlots()) {
                candidates.add(currentWorker);
            }
        }
        if (candidates.size() == 0) {
            throw new UnassignedActionException();
        }
    }
    this.schedule(actionScore, candidates);
}
Also used : UnassignedActionException(es.bsc.compss.scheduler.exceptions.UnassignedActionException) BlockedActionException(es.bsc.compss.scheduler.exceptions.BlockedActionException) WorkerResourceDescription(es.bsc.compss.types.resources.WorkerResourceDescription) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) ResourceScheduler(es.bsc.compss.components.impl.ResourceScheduler) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) LinkedList(java.util.LinkedList)

Example 4 with UnassignedActionException

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

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

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