Search in sources :

Example 6 with Profile

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

the class TaskScheduler method getTaskSummary.

/*
     * *********************************************************************************************************
     * *********************************************************************************************************
     * ********************************* MONITORING OPERATIONS *************************************************
     * *********************************************************************************************************
     * *********************************************************************************************************
     */
/**
 * Prints the task summary on a given logger @logger
 *
 * @param logger
 */
public final void getTaskSummary(Logger logger) {
    LOGGER.info("[TaskScheduler] Get task summary");
    // Structures for global and per worker stats
    int coreCount = CoreManager.getCoreCount();
    Profile[] coreGlobalProfiles = new Profile[coreCount];
    for (int i = 0; i < coreCount; ++i) {
        coreGlobalProfiles[i] = new Profile();
    }
    HashMap<String, Profile[]> coreProfilesPerWorker = new HashMap<>();
    // Retrieve information
    for (ResourceScheduler<? extends WorkerResourceDescription> ui : workers.values()) {
        if (ui == null) {
            continue;
        }
        Profile[] coreProfiles = new Profile[coreCount];
        for (int i = 0; i < coreCount; ++i) {
            coreProfiles[i] = new Profile();
        }
        List<Implementation>[] impls = ui.getExecutableImpls();
        for (int coreId = 0; coreId < coreCount; coreId++) {
            for (Implementation impl : impls[coreId]) {
                String signature = CoreManager.getSignature(coreId, impl.getImplementationId());
                boolean isPhantomSignature = signature.endsWith(")");
                if (!isPhantomSignature) {
                    // Phantom signatures are used for external execution wrappers (MPI, OMPSs, etc.)
                    coreGlobalProfiles[coreId].accumulate(ui.getProfile(impl));
                    coreProfiles[coreId].accumulate(ui.getProfile(impl));
                }
            }
        }
        coreProfilesPerWorker.put(ui.getName(), coreProfiles);
    }
    // Process information in output format
    logger.warn("------- COMPSs Task Execution Summary per Worker ------");
    for (Entry<String, Profile[]> workerInfo : coreProfilesPerWorker.entrySet()) {
        String workerName = workerInfo.getKey();
        Profile[] workerCoreProfiles = workerInfo.getValue();
        logger.warn("--- Summary for COMPSs Worker " + workerName);
        long totalExecutedTasksInWorker = 0;
        for (Entry<String, Integer> entry : CoreManager.getSignaturesToId().entrySet()) {
            String signature = entry.getKey();
            boolean isPhantomSignature = signature.endsWith(")");
            if (!isPhantomSignature) {
                int coreId = entry.getValue();
                long executionCount = workerCoreProfiles[coreId].getExecutionCount();
                totalExecutedTasksInWorker += executionCount;
                String info = executionCount + " " + signature + " tasks have been executed";
                logger.warn(info);
            }
        }
        logger.warn("--- Total executed tasks in COMPSs Worker " + workerName + ": " + totalExecutedTasksInWorker);
    }
    logger.warn("-------------------------------------------------------");
    logger.warn("");
    logger.warn("------------ COMPSs Task Execution Summary ------------");
    long totalExecutedTasks = 0;
    for (Entry<String, Integer> entry : CoreManager.getSignaturesToId().entrySet()) {
        String signature = entry.getKey();
        boolean isPhantomSignature = signature.endsWith(")");
        if (!isPhantomSignature) {
            int coreId = entry.getValue();
            long executionCount = coreGlobalProfiles[coreId].getExecutionCount();
            totalExecutedTasks += executionCount;
            String info = executionCount + " " + signature + " tasks have been executed";
            logger.warn(info);
        }
    }
    logger.warn("Total executed tasks: " + totalExecutedTasks);
    logger.warn("-------------------------------------------------------");
}
Also used : HashMap(java.util.HashMap) Profile(es.bsc.compss.scheduler.types.Profile) Implementation(es.bsc.compss.types.implementations.Implementation) LinkedList(java.util.LinkedList) List(java.util.List)

Example 7 with Profile

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

the class JSONStateManager method addResourceJSON.

public void addResourceJSON(ResourceScheduler<? extends WorkerResourceDescription> rs) {
    // Increasing Implementation stats
    int coreCount = CoreManager.getCoreCount();
    for (int coreId = 0; coreId < coreCount; coreId++) {
        for (int implId = 0; implId < CoreManager.getNumberCoreImplementations(coreId); implId++) {
            JSONObject implJSON = getJSONForImplementation(coreId, implId);
            Profile p = rs.getProfile(coreId, implId);
            if (implJSON == null) {
                addImplementationJSON(coreId, implId, p);
            } else {
                accumulateImplementationJSON(coreId, implId, p);
            }
        }
    }
    // Attaching new resource to the resources
    JSONObject resources = getJSONForResources();
    resources.put(rs.getName(), rs.toJSONObject());
}
Also used : JSONObject(org.json.JSONObject) Profile(es.bsc.compss.scheduler.types.Profile)

Example 8 with Profile

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

the class TaskScheduler method updateResourceJSON.

public void updateResourceJSON(ResourceScheduler<? extends WorkerResourceDescription> rs) {
    JSONObject difference = jsm.updateResourceJSON(rs);
    JSONObject implsdiff = difference.getJSONObject("implementations");
    // Increasing Implementation stats
    int coreCount = CoreManager.getCoreCount();
    for (int coreId = 0; coreId < coreCount; coreId++) {
        for (int implId = 0; implId < CoreManager.getNumberCoreImplementations(coreId); implId++) {
            JSONObject implJSON = jsm.getJSONForImplementation(coreId, implId);
            Profile p = generateProfile(implsdiff.getJSONObject(CoreManager.getSignature(coreId, implId)));
            if (implJSON == null) {
                jsm.addImplementationJSON(coreId, implId, p);
            } else {
                jsm.accumulateImplementationJSON(coreId, implId, p);
            }
        }
    }
}
Also used : JSONObject(org.json.JSONObject) Profile(es.bsc.compss.scheduler.types.Profile)

Aggregations

Profile (es.bsc.compss.scheduler.types.Profile)8 Implementation (es.bsc.compss.types.implementations.Implementation)6 LinkedList (java.util.LinkedList)4 List (java.util.List)4 JSONObject (org.json.JSONObject)3 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)2 BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)1 InvalidSchedulingException (es.bsc.compss.scheduler.exceptions.InvalidSchedulingException)1 UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)1 MOSchedulingInformation (es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation)1 StopWorkerAction (es.bsc.compss.scheduler.types.allocatableactions.StopWorkerAction)1 CloudMethodWorker (es.bsc.compss.types.resources.CloudMethodWorker)1 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)1 HashMap (java.util.HashMap)1 JSONException (org.json.JSONException)1