Search in sources :

Example 1 with StopWorkerAction

use of es.bsc.compss.scheduler.types.allocatableactions.StopWorkerAction 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)

Aggregations

BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)1 InvalidSchedulingException (es.bsc.compss.scheduler.exceptions.InvalidSchedulingException)1 UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)1 Profile (es.bsc.compss.scheduler.types.Profile)1 StopWorkerAction (es.bsc.compss.scheduler.types.allocatableactions.StopWorkerAction)1 Implementation (es.bsc.compss.types.implementations.Implementation)1 CloudMethodWorker (es.bsc.compss.types.resources.CloudMethodWorker)1 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1