Search in sources :

Example 16 with Implementation

use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.

the class CoreManager method debugString.

/*
     * *****************************************************************************************************
     * *****************************************************************************************************
     * ************** DEBUG OPERATIONS *********************************************************************
     * *****************************************************************************************************
     * *****************************************************************************************************
     */
public static String debugString() {
    StringBuilder sb = new StringBuilder();
    sb.append("Core Count: ").append(coreCount).append("\n");
    for (int coreId = 0; coreId < coreCount; coreId++) {
        sb.append("\tCore ").append(coreId).append(":\n");
        for (Implementation impl : IMPLEMENTATIONS.get(coreId)) {
            sb.append("\t\t -").append(impl.toString()).append("\n");
        }
    }
    return sb.toString();
}
Also used : Implementation(es.bsc.compss.types.implementations.Implementation)

Example 17 with Implementation

use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.

the class Test method cloudManagerTest.

/*
     * *********************************** CLOUD MANAGER TEST IMPLEMENTATION ***********************************
     */
private static void cloudManagerTest() {
    // Print Out CloudManager static structures
    System.out.println("[LOG] CloudManager Static Structures definition");
    // Check for each implementation the correctness of its resources
    coreCount = CoreManager.getCoreCount();
    CloudProvider cp = ResourceManager.getCloudProvider("BSC");
    for (int coreId = 0; coreId < coreCount; coreId++) {
        System.out.println("[LOG] Checking Core" + coreId);
        for (Implementation impl : CoreManager.getCoreImplementations(coreId)) {
            if (impl.getTaskType().equals(TaskType.METHOD)) {
                System.out.println("[LOG]\t Checking Implementation: " + impl.getImplementationId());
                System.out.println("\t\t Checking obtained compatible cloud images");
                MethodImplementation mImpl = (MethodImplementation) impl;
                for (CloudImageDescription cid_gci : cp.getCompatibleImages(mImpl.getRequirements())) {
                    System.out.println("\t\t\t Checking compatible Image: " + cid_gci.getImageName());
                    String res = checkImplementationAssignedToCloudImage(mImpl.getRequirements(), cid_gci);
                    if (res != null) {
                        String error = "[ERROR] Implementation: Core = " + coreId + " Impl = " + impl.getImplementationId() + ". ";
                        error = error.concat("Implementation and cloud image not matching on: " + res);
                        System.out.println(error);
                        System.exit(-1);
                    }
                }
                System.out.println("\t\t Checking obtained compatible cloud types");
                for (CloudInstanceTypeDescription type : cp.getCompatibleTypes(new CloudMethodResourceDescription(mImpl.getRequirements()))) {
                    if (type.getResourceDescription().canHostSimultaneously(mImpl.getRequirements()) < 1) {
                        continue;
                    }
                    System.out.println("\t\t\t Checking compatible Type: " + type.getName());
                    String res = checkImplementationAssignedToType(mImpl.getRequirements(), type.getResourceDescription());
                    if (res != null) {
                        String error = "[ERROR] Implementation: Core = " + coreId + " Impl = " + impl.getImplementationId() + ". ";
                        error = error.concat("Implementation and type not matching on: " + res);
                        System.out.println(error);
                        System.exit(-1);
                    }
                }
            }
        }
    }
    // Return success value
    System.out.println("[LOG] * CloudManager test passed");
}
Also used : MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) CloudProvider(es.bsc.compss.types.CloudProvider) CloudImageDescription(es.bsc.compss.types.resources.description.CloudImageDescription) CloudInstanceTypeDescription(es.bsc.compss.types.resources.description.CloudInstanceTypeDescription) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription) MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) Implementation(es.bsc.compss.types.implementations.Implementation)

Example 18 with Implementation

use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.

the class Action method findAvailableWorkers.

@SuppressWarnings("unchecked")
public Map<Worker<?>, List<Implementation>> findAvailableWorkers() {
    Map<Worker<?>, List<Implementation>> m = new HashMap<>();
    List<ResourceScheduler<? extends WorkerResourceDescription>> compatibleWorkers = getCoreElementExecutors(coreId);
    for (ResourceScheduler<? extends WorkerResourceDescription> ui : compatibleWorkers) {
        Worker<WorkerResourceDescription> r = (Worker<WorkerResourceDescription>) ui.getResource();
        List<Implementation> compatibleImpls = r.getExecutableImpls(coreId);
        List<Implementation> runnableImpls = new LinkedList<>();
        for (Implementation impl : compatibleImpls) {
            if (r.canRunNow(impl.getRequirements())) {
                runnableImpls.add(impl);
            }
        }
        if (runnableImpls.size() > 0) {
            m.put((Worker<?>) r, runnableImpls);
        }
    }
    return m;
}
Also used : HashMap(java.util.HashMap) WorkerResourceDescription(es.bsc.compss.types.resources.WorkerResourceDescription) Worker(es.bsc.compss.types.resources.Worker) List(java.util.List) LinkedList(java.util.LinkedList) ResourceScheduler(es.bsc.compss.components.impl.ResourceScheduler) Implementation(es.bsc.compss.types.implementations.Implementation) LinkedList(java.util.LinkedList)

Example 19 with Implementation

use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.

the class Test method checkCoreElementConstraints.

private static void checkCoreElementConstraints(int coreId) {
    System.out.println("[LOG] Checking " + coreToName[coreId]);
    System.out.println("[LOG] \t Has " + declaringClassesItf[coreId].length + " declaring classes in the CEI");
    System.out.println("[LOG] \t Has " + idToSignatures[coreId].size() + " signatures registered");
    // Signatures store one dummy extra signature
    if (declaringClassesItf[coreId].length + 1 != idToSignatures[coreId].size()) {
        System.out.println(coreToName[coreId] + " has " + idToSignatures[coreId].size() + " registered signatures and there are " + declaringClassesItf[coreId].length + " declaringClasses in the CEI");
        System.exit(-1);
    }
    List<Implementation> implementations = CoreManager.getCoreImplementations(coreId);
    System.out.println("[LOG] \t Has " + implementations.size() + " implementations registered");
    if (declaringClassesItf[coreId].length != implementations.size()) {
        System.out.println(coreToName[coreId] + " has " + implementations.size() + " registered implementations and there are " + declaringClassesItf[coreId].length + " declaringClasses in the CEI");
        System.exit(-1);
    }
    // Check all constraints
    for (int implId = 0; implId < declaringClassesItf[coreId].length; implId++) {
        MethodImplementation m = ((MethodImplementation) implementations.get(implId));
        System.out.println("[LOG] \t" + declaringClassesItf[coreId][implId]);
        if (declaringClassesItf[coreId][implId].compareTo(m.getDeclaringClass()) != 0) {
            System.out.println(coreToName[coreId] + "'s declaringClass " + declaringClassesItf[coreId][implId] + " is not included registered in the system");
            System.exit(-1);
        }
        String constraint = checkConstraints(generalConstraintsItf[coreId], constraintsItf[coreId][implId], m.getRequirements());
        if (constraint != null) {
            System.out.println("Constraints for " + coreToName[coreId] + "'s declaringClass " + declaringClassesItf[coreId][implId] + " does not meet the annotations (" + constraint + ")");
            System.exit(-1);
        }
    }
}
Also used : MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) Implementation(es.bsc.compss.types.implementations.Implementation)

Example 20 with Implementation

use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.

the class TestCompatible method checkCoreResources.

private static void checkCoreResources(int coreId, Map<Worker<?>, List<Implementation>> hm) {
    // Revert Map
    Map<Implementation, List<Worker<?>>> hm_reverted = new HashMap<>();
    for (Entry<Worker<?>, List<Implementation>> entry_hm : hm.entrySet()) {
        for (Implementation impl : entry_hm.getValue()) {
            List<Worker<?>> aux = hm_reverted.get(impl);
            if (aux == null) {
                aux = new LinkedList<Worker<?>>();
            }
            aux.add(entry_hm.getKey());
            hm_reverted.put(impl, aux);
        }
    }
    // Check Resources assigned to each implementation
    for (Entry<Implementation, List<Worker<?>>> entry : hm_reverted.entrySet()) {
        System.out.println("[LOG] ** Checking Implementation " + entry.getKey());
        System.out.println("[LOG] **** Number of resources = " + entry.getValue().size());
        for (Worker<?> resource : entry.getValue()) {
            System.out.println("[LOG] **** Checking Resource " + resource.getName());
            String res = checkResourcesAssignedToImpl(entry.getKey(), resource);
            if (res != null) {
                String error = "Implementation: Core " + coreId + " Impl " + entry.getKey().getImplementationId() + " and Resource " + resource.getName() + ". ";
                error = error.concat("Implementation and resource not matching on: " + res);
                System.out.println(error);
                System.exit(-1);
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) ServiceWorker(es.bsc.compss.types.resources.ServiceWorker) Worker(es.bsc.compss.types.resources.Worker) MethodWorker(es.bsc.compss.types.resources.MethodWorker) List(java.util.List) LinkedList(java.util.LinkedList) Implementation(es.bsc.compss.types.implementations.Implementation) ServiceImplementation(es.bsc.compss.types.implementations.ServiceImplementation) MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation)

Aggregations

Implementation (es.bsc.compss.types.implementations.Implementation)54 MethodImplementation (es.bsc.compss.types.implementations.MethodImplementation)24 MethodResourceDescription (es.bsc.compss.types.resources.MethodResourceDescription)20 LinkedList (java.util.LinkedList)19 JSONObject (org.json.JSONObject)13 Test (org.junit.Test)12 ResourceScheduler (es.bsc.compss.components.impl.ResourceScheduler)10 List (java.util.List)9 MOProfile (es.bsc.compss.scheduler.multiobjective.types.MOProfile)8 CloudMethodResourceDescription (es.bsc.compss.types.resources.description.CloudMethodResourceDescription)8 HashMap (java.util.HashMap)7 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)6 Profile (es.bsc.compss.scheduler.types.Profile)6 BeforeClass (org.junit.BeforeClass)6 CloudInstanceTypeDescription (es.bsc.compss.types.resources.description.CloudInstanceTypeDescription)5 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)4 Score (es.bsc.compss.scheduler.types.Score)3 ServiceImplementation (es.bsc.compss.types.implementations.ServiceImplementation)3 Worker (es.bsc.compss.types.resources.Worker)3 Processor (es.bsc.compss.types.resources.components.Processor)3