Search in sources :

Example 16 with CloudImageDescription

use of es.bsc.compss.types.resources.description.CloudImageDescription in project compss by bsc-wdc.

the class ResourceManagerTest method createResourceDescriptionFromProvider.

private CloudMethodResourceDescription createResourceDescriptionFromProvider(CloudProvider cp1) {
    CloudImageDescription cid = null;
    CloudInstanceTypeDescription citd = null;
    for (String imageName : cp1.getAllImageNames()) {
        cid = cp1.getImage(imageName);
        break;
    }
    for (String instanceType : cp1.getAllInstanceTypeNames()) {
        citd = cp1.getInstanceType(instanceType);
        break;
    }
    return new CloudMethodResourceDescription(citd, cid);
}
Also used : CloudImageDescription(es.bsc.compss.types.resources.description.CloudImageDescription) CloudInstanceTypeDescription(es.bsc.compss.types.resources.description.CloudInstanceTypeDescription) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription)

Example 17 with CloudImageDescription

use of es.bsc.compss.types.resources.description.CloudImageDescription in project compss by bsc-wdc.

the class Converter method toCloudMethodResourceDescription.

/**
 *********************************************************************
 ************************ CONN TO COMPSs *****************************
 * *********************************************************************
 */
/**
 * @param vr
 * @param requested
 * @return
 */
public static CloudMethodResourceDescription toCloudMethodResourceDescription(VirtualResource vr, CloudMethodResourceDescription requested) {
    CloudMethodResourceDescription cmrd = new CloudMethodResourceDescription();
    cmrd.setName(vr.getIp());
    setHardwareInResourceDescription(cmrd, vr.getHd(), requested);
    setSoftwareInResourceDescription(cmrd, vr.getSd(), requested);
    CloudImageDescription cid = getCloudImageDescription(vr.getHd(), vr.getSd(), requested);
    cmrd.setImage(cid);
    return cmrd;
}
Also used : CloudImageDescription(es.bsc.compss.types.resources.description.CloudImageDescription) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription)

Example 18 with CloudImageDescription

use of es.bsc.compss.types.resources.description.CloudImageDescription in project compss by bsc-wdc.

the class Converter method getCloudImageDescription.

/**
 * Returns the cloud image description
 *
 * @param hd
 * @param sd
 * @param requested
 * @return
 */
private static CloudImageDescription getCloudImageDescription(HardwareDescription hd, SoftwareDescription sd, CloudMethodResourceDescription requested) {
    CloudImageDescription from = requested.getImage();
    CloudImageDescription cid = new CloudImageDescription(hd.getImageName(), hd.getImageProperties());
    cid.setOperatingSystemType(sd.getOperatingSystemType());
    cid.setOperatingSystemDistribution(sd.getOperatingSystemDistribution());
    cid.setOperatingSystemVersion(sd.getOperatingSystemVersion());
    cid.setAppSoftware(sd.getAppSoftware());
    cid.setPricePerUnit(hd.getPricePerUnit());
    cid.setPriceTimeUnit(hd.getPriceTimeUnit());
    cid.setConfig(from.getConfig());
    cid.setQueues(from.getQueues());
    cid.setSharedDisks(from.getSharedDisks());
    cid.setPackages(from.getPackages());
    return cid;
}
Also used : CloudImageDescription(es.bsc.compss.types.resources.description.CloudImageDescription)

Example 19 with CloudImageDescription

use of es.bsc.compss.types.resources.description.CloudImageDescription in project compss by bsc-wdc.

the class ResourceOptimizer method mandatoryReduction.

private void mandatoryReduction(float[] destroyRecommendations) {
    List<CloudMethodWorker> critical = trimReductionOptions(ResourceManager.getCriticalDynamicResources(), destroyRecommendations);
    // LinkedList<CloudMethodWorker> critical = checkCriticalSafeness
    // (critical);
    List<CloudMethodWorker> nonCritical = trimReductionOptions(ResourceManager.getNonCriticalDynamicResources(), destroyRecommendations);
    Object[] criticalSolution = getBestDestruction(critical, destroyRecommendations);
    Object[] nonCriticalSolution = getBestDestruction(nonCritical, destroyRecommendations);
    boolean criticalIsBetter;
    if (criticalSolution == null) {
        if (nonCriticalSolution == null) {
            return;
        } else {
            criticalIsBetter = false;
        }
    } else if (nonCriticalSolution == null) {
        criticalIsBetter = true;
    } else {
        criticalIsBetter = false;
        float[] noncriticalValues = (float[]) nonCriticalSolution[2];
        float[] criticalValues = (float[]) criticalSolution[2];
        if (noncriticalValues[0] == criticalValues[0]) {
            if (noncriticalValues[1] == criticalValues[1]) {
                if (noncriticalValues[2] < criticalValues[2]) {
                    criticalIsBetter = true;
                }
            } else if (noncriticalValues[1] > criticalValues[1]) {
                criticalIsBetter = true;
            }
        } else if (noncriticalValues[0] > criticalValues[0]) {
            criticalIsBetter = true;
        }
    }
    CloudMethodWorker res;
    CloudMethodResourceDescription cmrd;
    // float[] record;
    // int[][] slotsRemovingCount;
    CloudInstanceTypeDescription citd;
    if (criticalIsBetter) {
        res = (CloudMethodWorker) criticalSolution[0];
        citd = (CloudInstanceTypeDescription) criticalSolution[1];
    } else {
        if (nonCriticalSolution == null) {
            return;
        }
        res = (CloudMethodWorker) nonCriticalSolution[0];
        citd = (CloudInstanceTypeDescription) nonCriticalSolution[1];
    }
    cmrd = (CloudMethodResourceDescription) res.getDescription();
    CloudImageDescription cid = cmrd.getImage();
    CloudMethodResourceDescription finalDescription = new CloudMethodResourceDescription(citd, cid);
    finalDescription.setName(res.getName());
    ResourceManager.reduceCloudWorker(res, finalDescription);
}
Also used : CloudMethodWorker(es.bsc.compss.types.resources.CloudMethodWorker) CloudInstanceTypeDescription(es.bsc.compss.types.resources.description.CloudInstanceTypeDescription) CloudImageDescription(es.bsc.compss.types.resources.description.CloudImageDescription) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription) JSONObject(org.json.JSONObject)

Example 20 with CloudImageDescription

use of es.bsc.compss.types.resources.description.CloudImageDescription in project compss by bsc-wdc.

the class MOResourceOptimizer method generatePossibleResourceReleases.

private void generatePossibleResourceReleases(LinkedList<Action> actions, Resource<?>[] allResources, int[] load) {
    for (int i = 0; i < allResources.length; i++) {
        Resource<?> excludedWorker = allResources[i];
        Worker<?> w = excludedWorker.getResource();
        // If worker is null, worker is being created. It cannot be destroyed yet.
        if (w == null || !(w.getDescription() instanceof CloudMethodResourceDescription)) {
            continue;
        }
        CloudMethodResourceDescription description = (CloudMethodResourceDescription) w.getDescription();
        if (!(excludedWorker.hasPendingModifications())) {
            CloudImageDescription image = description.getImage();
            for (CloudInstanceTypeDescription typeReduction : description.getPossibleReductions()) {
                CloudMethodResourceDescription reductionDescription = new CloudMethodResourceDescription(typeReduction, image);
                CloudMethodResourceDescription reducedDescription = new CloudMethodResourceDescription(description);
                reducedDescription.reduce(reductionDescription);
                ConfigurationCost cc;
                if (reducedDescription.getTypeComposition().isEmpty()) {
                    Resource<?>[] resources = new Resource[allResources.length - 1];
                    System.arraycopy(allResources, 0, resources, 0, i);
                    System.arraycopy(allResources, i + 1, resources, i, resources.length - i);
                    long time = excludedWorker.startTime;
                    double energy = excludedWorker.idlePower * time + excludedWorker.startEnergy;
                    double cost = excludedWorker.startCost;
                    cc = simulate(load, resources, time, energy, cost);
                } else {
                    allResources[i] = reduceResourceForComponent(excludedWorker, reducedDescription);
                    long time = excludedWorker.startTime;
                    double energy = excludedWorker.idlePower * time + excludedWorker.startEnergy;
                    double cost = excludedWorker.startCost;
                    cc = simulate(load, allResources, time, energy, cost);
                    allResources[i] = excludedWorker;
                }
                Action a = new ActionRemove(excludedWorker, typeReduction, cc);
                addToLog(a.toString());
                actions.add(a);
            }
        }
    }
}
Also used : CloudImageDescription(es.bsc.compss.types.resources.description.CloudImageDescription) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription) CloudInstanceTypeDescription(es.bsc.compss.types.resources.description.CloudInstanceTypeDescription)

Aggregations

CloudImageDescription (es.bsc.compss.types.resources.description.CloudImageDescription)31 CloudMethodResourceDescription (es.bsc.compss.types.resources.description.CloudMethodResourceDescription)23 CloudInstanceTypeDescription (es.bsc.compss.types.resources.description.CloudInstanceTypeDescription)22 HashMap (java.util.HashMap)15 MethodResourceDescription (es.bsc.compss.types.resources.MethodResourceDescription)12 Test (org.junit.Test)12 CloudMethodWorker (es.bsc.compss.types.resources.CloudMethodWorker)9 FakeNode (es.bsc.compss.types.fake.FakeNode)7 CloudProvider (es.bsc.compss.types.CloudProvider)6 MethodConfiguration (es.bsc.compss.types.resources.configuration.MethodConfiguration)3 ConstructConfigurationException (es.bsc.compss.exceptions.ConstructConfigurationException)2 es.bsc.compss.types.project.jaxb (es.bsc.compss.types.project.jaxb)2 LinkedList (java.util.LinkedList)2 ConnectorException (es.bsc.compss.connectors.ConnectorException)1 NoResourceAvailableException (es.bsc.compss.exceptions.NoResourceAvailableException)1 ResourceCreationRequest (es.bsc.compss.types.ResourceCreationRequest)1 Implementation (es.bsc.compss.types.implementations.Implementation)1 MethodImplementation (es.bsc.compss.types.implementations.MethodImplementation)1 ProjectFileValidationException (es.bsc.compss.types.project.exceptions.ProjectFileValidationException)1 ShutdownListener (es.bsc.compss.types.resources.ShutdownListener)1