Search in sources :

Example 1 with ObjectValue

use of es.bsc.compss.scheduler.types.ObjectValue 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 2 with ObjectValue

use of es.bsc.compss.scheduler.types.ObjectValue 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 3 with ObjectValue

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

the class TaskScheduler method handleDependencyFreeActions.

/**
 * Notifies to the scheduler that some actions have become free of data dependencies or resource dependencies.
 *
 * @param <T>
 * @param dataFreeActions
 *            IN, list of actions free of data dependencies
 * @param resourceFreeActions
 *            IN, list of actions free of resource dependencies
 * @param blockedCandidates
 *            OUT, list of blocked candidates
 * @param resource
 *            Resource where the previous task was executed
 */
public <T extends WorkerResourceDescription> void handleDependencyFreeActions(List<AllocatableAction> dataFreeActions, List<AllocatableAction> resourceFreeActions, List<AllocatableAction> blockedCandidates, ResourceScheduler<T> resource) {
    LOGGER.debug("[TaskScheduler] Treating dependency free actions");
    // All actions should have already been assigned to a resource, no need
    // to change the assignation once they become free of dependencies
    // Try to launch all the data free actions and the resource free actions
    PriorityQueue<ObjectValue<AllocatableAction>> executableActions = new PriorityQueue<>();
    for (AllocatableAction freeAction : dataFreeActions) {
        Score actionScore = generateActionScore(freeAction);
        Score fullScore = freeAction.schedulingScore(resource, actionScore);
        ObjectValue<AllocatableAction> obj = new ObjectValue<>(freeAction, fullScore);
        executableActions.add(obj);
    }
    for (AllocatableAction freeAction : resourceFreeActions) {
        Score actionScore = generateActionScore(freeAction);
        Score fullScore = freeAction.schedulingScore(resource, actionScore);
        ObjectValue<AllocatableAction> obj = new ObjectValue<>(freeAction, fullScore);
        if (!executableActions.contains(obj)) {
            executableActions.add(obj);
        }
    }
    while (!executableActions.isEmpty()) {
        ObjectValue<AllocatableAction> obj = executableActions.poll();
        AllocatableAction freeAction = obj.getObject();
        tryToLaunch(freeAction);
    }
}
Also used : Score(es.bsc.compss.scheduler.types.Score) ObjectValue(es.bsc.compss.scheduler.types.ObjectValue) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) PriorityQueue(java.util.PriorityQueue)

Example 4 with ObjectValue

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

the class ReadyScheduler method tryToLaunchFreeActions.

private <T extends WorkerResourceDescription> void tryToLaunchFreeActions(List<AllocatableAction> dataFreeActions, List<AllocatableAction> resourceFreeActions, List<AllocatableAction> blockedCandidates, ResourceScheduler<T> resource) {
    // Try to launch all the data free actions and the resource free actions
    PriorityQueue<ObjectValue<AllocatableAction>> executableActions = new PriorityQueue<>();
    for (AllocatableAction freeAction : dataFreeActions) {
        Score actionScore = generateActionScore(freeAction);
        Score fullScore = freeAction.schedulingScore(resource, actionScore);
        ObjectValue<AllocatableAction> obj = new ObjectValue<>(freeAction, fullScore);
        executableActions.add(obj);
    }
    for (AllocatableAction freeAction : resourceFreeActions) {
        Score actionScore = generateActionScore(freeAction);
        Score fullScore = freeAction.schedulingScore(resource, actionScore);
        ObjectValue<AllocatableAction> obj = new ObjectValue<>(freeAction, fullScore);
        if (!executableActions.contains(obj)) {
            executableActions.add(obj);
        }
    }
    while (!executableActions.isEmpty()) {
        ObjectValue<AllocatableAction> obj = executableActions.poll();
        AllocatableAction freeAction = obj.getObject();
        // LOGGER.debug("Trying to launch action " + freeAction);
        try {
            scheduleAction(freeAction, obj.getScore());
            tryToLaunch(freeAction);
        } catch (BlockedActionException e) {
            removeFromReady(freeAction);
            addToBlocked(freeAction);
        }
    }
}
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)

Aggregations

AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)4 ObjectValue (es.bsc.compss.scheduler.types.ObjectValue)4 Score (es.bsc.compss.scheduler.types.Score)4 PriorityQueue (java.util.PriorityQueue)4 BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)3 UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)1