Search in sources :

Example 36 with AllocatableAction

use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.

the class LocalOptimizationState method releaseDataSuccessors.

public void releaseDataSuccessors(MOSchedulingInformation dsi, long timeLimit) {
    List<AllocatableAction> successors = dsi.getOptimizingSuccessors();
    for (AllocatableAction successor : successors) {
        MOSchedulingInformation successorDSI = (MOSchedulingInformation) successor.getSchedulingInfo();
        int missingParams = 0;
        long startTime = 0;
        boolean retry = true;
        while (retry) {
            try {
                List<AllocatableAction> predecessors = successor.getDataPredecessors();
                for (AllocatableAction predecessor : predecessors) {
                    MOSchedulingInformation predDSI = ((MOSchedulingInformation) predecessor.getSchedulingInfo());
                    if (predecessor.getAssignedResource() != worker) {
                        startTime = Math.max(startTime, predDSI.getExpectedEnd());
                    } else if (predDSI.isOnOptimization()) {
                        missingParams++;
                    } else {
                        startTime = Math.max(startTime, predDSI.getExpectedEnd());
                    }
                }
                retry = false;
            } catch (ConcurrentModificationException cme) {
                missingParams = 0;
                startTime = 0;
            }
        }
        successorDSI.setExpectedStart(startTime);
        if (missingParams == 0) {
            if (successorDSI.getExpectedStart() <= timeLimit) {
                selectableActions.offer(successor);
            } else {
                readyActions.add(successor);
            }
        }
    }
    dsi.clearOptimizingSuccessors();
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation) ConcurrentModificationException(java.util.ConcurrentModificationException) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction)

Example 37 with AllocatableAction

use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.

the class PriorityActionSet method poll.

public AllocatableAction poll() {
    AllocatableAction currentPeek;
    while ((currentPeek = priority.poll()) != null) {
        Integer coreId = currentPeek.getCoreId();
        AllocatableAction nextPeek;
        if (coreId == null) {
            noCoreActions.poll();
            nextPeek = noCoreActions.peek();
        } else {
            coreActions[coreId].poll();
            nextPeek = coreActions[coreId].peek();
        }
        if (nextPeek != null) {
            priority.offer(nextPeek);
        }
        MOSchedulingInformation dsi = (MOSchedulingInformation) currentPeek.getSchedulingInfo();
        if (dsi.isToReschedule()) {
            break;
        }
    }
    return currentPeek;
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction)

Example 38 with AllocatableAction

use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.

the class PriorityActionSet method peek.

public AllocatableAction peek() {
    AllocatableAction currentPeek = priority.peek();
    while (currentPeek != null && !((MOSchedulingInformation) currentPeek.getSchedulingInfo()).isToReschedule()) {
        removeFirst(currentPeek.getCoreId());
        currentPeek = priority.peek();
    }
    return currentPeek;
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction)

Example 39 with AllocatableAction

use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.

the class PriorityActionSet method peekAll.

public PriorityQueue<AllocatableAction> peekAll() {
    PriorityQueue<AllocatableAction> peeks = new PriorityQueue<AllocatableAction>(coreActions.length + 1, comparator);
    AllocatableAction currentCore = noCoreActions.peek();
    if (currentCore != null && !((MOSchedulingInformation) currentCore.getSchedulingInfo()).isToReschedule()) {
        noCoreActions.poll();
        currentCore = noCoreActions.peek();
    }
    if (currentCore != null) {
        peeks.offer(currentCore);
    }
    for (PriorityQueue<AllocatableAction> core : coreActions) {
        currentCore = core.peek();
        if (currentCore != null && !((MOSchedulingInformation) currentCore.getSchedulingInfo()).isToReschedule()) {
            core.poll();
            currentCore = core.peek();
        }
        if (currentCore != null) {
            peeks.offer(currentCore);
        }
    }
    return peeks;
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) PriorityQueue(java.util.PriorityQueue)

Example 40 with AllocatableAction

use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.

the class ActionSet method removeAllActions.

public List<AllocatableAction> removeAllActions() {
    List<AllocatableAction> runnable = new LinkedList<>();
    Iterator<AllocatableAction> actions = this.noCore.iterator();
    while (actions.hasNext()) {
        AllocatableAction action = actions.next();
        actions.remove();
        runnable.add(action);
    }
    for (int core = 0; core < this.coreIndexed.length; ++core) {
        runnable.addAll(coreIndexed[core]);
        this.coreIndexed[core] = new LinkedList<>();
        this.counts[core] = 0;
    }
    totalActions = 0;
    return runnable;
}
Also used : AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) LinkedList(java.util.LinkedList)

Aggregations

AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)43 LinkedList (java.util.LinkedList)13 MOSchedulingInformation (es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation)11 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)10 PriorityQueue (java.util.PriorityQueue)10 Gap (es.bsc.compss.scheduler.multiobjective.types.Gap)9 Score (es.bsc.compss.scheduler.types.Score)7 BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)6 Implementation (es.bsc.compss.types.implementations.Implementation)6 ResourceDescription (es.bsc.compss.types.resources.ResourceDescription)6 ActionNotFoundException (es.bsc.compss.scheduler.exceptions.ActionNotFoundException)5 ConcurrentModificationException (java.util.ConcurrentModificationException)5 ObjectValue (es.bsc.compss.scheduler.types.ObjectValue)4 MOProfile (es.bsc.compss.scheduler.multiobjective.types.MOProfile)3 HashSet (java.util.HashSet)3 FailedActionException (es.bsc.compss.scheduler.exceptions.FailedActionException)2 UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)2 MOScore (es.bsc.compss.scheduler.multiobjective.types.MOScore)2 OptimizationAction (es.bsc.compss.scheduler.multiobjective.types.OptimizationAction)2 Profile (es.bsc.compss.scheduler.types.Profile)2