Search in sources :

Example 21 with CloudMethodResourceDescription

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

the class CloudProvider method getCurrentState.

/*
     * ----------------------------------------- ------------- Debug Queries -------------
     * ----------------------------------------
     */
public String getCurrentState(String prefix) {
    StringBuilder sb = new StringBuilder();
    sb.append(prefix).append("PROVIDER = [").append("\n");
    sb.append(prefix).append("\t").append("NAME = ").append(name).append("\n");
    sb.append(prefix).append("\t").append("CURRENT_VM = ").append(currentVMCount).append("\n");
    sb.append(prefix).append("\t").append("LIMIT_VM = ").append(limitOfVMs).append("\n");
    sb.append(imgManager.getCurrentState(prefix + "\t"));
    sb.append(typeManager.getCurrentState(prefix + "\t"));
    // Virtual Instances
    sb.append(prefix).append("\t").append("VIRTUAL_INSTANCES = [").append("\n");
    for (CloudMethodWorker vm : hostedWorkers) {
        CloudMethodResourceDescription cmrd = vm.getDescription();
        sb.append(cmrd.getCurrentState(prefix + "\t")).append("\n");
    }
    sb.append(prefix).append("\t").append("]").append("\n");
    sb.append(prefix).append("]").append("\n");
    return sb.toString();
}
Also used : CloudMethodWorker(es.bsc.compss.types.resources.CloudMethodWorker) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription)

Example 22 with CloudMethodResourceDescription

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

the class CloudProvider method refusedCreation.

public void refusedCreation(ResourceCreationRequest rcr) {
    CloudMethodResourceDescription cmrd = rcr.getRequested();
    for (int[] typeCount : cmrd.getTypeComposition().values()) {
        currentVMCount -= typeCount[0];
    }
    pendingRequests.remove(rcr);
    int[][] simultaneousCounts = rcr.requestedSimultaneousTaskCount();
    for (int coreId = 0; coreId < simultaneousCounts.length; coreId++) {
        int coreSlots = 0;
        for (int implId = 0; implId < simultaneousCounts[coreId].length; implId++) {
            coreSlots = Math.max(coreSlots, simultaneousCounts[coreId][implId]);
        }
        this.pendingCoreCount[coreId] -= coreSlots;
    }
}
Also used : CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription)

Example 23 with CloudMethodResourceDescription

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

the class CloudProvider method requestResourceCreation.

public ResourceCreationRequest requestResourceCreation(CloudMethodResourceDescription instanceDescription) {
    int[][] simultaneousCounts = computeSimultaneousCounts(instanceDescription);
    ResourceCreationRequest rcr = new ResourceCreationRequest(instanceDescription, simultaneousCounts, this);
    LOGGER.debug("[Cloud Manager] Asking for resource creation " + instanceDescription.getName() + " with image " + instanceDescription.getImage().getImageName());
    boolean isRequestAccepted = connector.turnON("compss" + UUID.randomUUID().toString(), rcr);
    if (isRequestAccepted) {
        CloudMethodResourceDescription cmrd = rcr.getRequested();
        for (int[] typeCount : cmrd.getTypeComposition().values()) {
            currentVMCount += typeCount[0];
        }
        pendingRequests.add(rcr);
        for (int coreId = 0; coreId < simultaneousCounts.length; coreId++) {
            int coreSlots = 0;
            for (int implId = 0; implId < simultaneousCounts[coreId].length; implId++) {
                coreSlots = Math.max(coreSlots, simultaneousCounts[coreId][implId]);
            }
            this.pendingCoreCount[coreId] += coreSlots;
        }
        return rcr;
    } else {
        LOGGER.warn(WARN_CANNOT_TURN_ON);
        return null;
    }
}
Also used : CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription)

Example 24 with CloudMethodResourceDescription

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

the class CloudProvider method getResourceDescription.

public CloudMethodResourceDescription getResourceDescription(String instanceTypeName, String imageName) {
    CloudMethodResourceDescription result = null;
    CloudInstanceTypeDescription type = typeManager.getType(instanceTypeName);
    if (type != null) {
        CloudImageDescription image = imgManager.getImage(imageName);
        if (image != null) {
            result = new CloudMethodResourceDescription(type, image);
            result.setValue(cost.getMachineCostPerHour(result));
        } else {
            LOGGER.warn(WARN_NO_VALID_IMAGE);
        }
    } else {
        LOGGER.warn(WARN_NO_VALID_INSTANCE);
    }
    return result;
}
Also used : CloudInstanceTypeDescription(es.bsc.compss.types.resources.description.CloudInstanceTypeDescription) CloudImageDescription(es.bsc.compss.types.resources.description.CloudImageDescription) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription)

Example 25 with CloudMethodResourceDescription

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

the class CloudProvider method confirmedCreation.

public void confirmedCreation(ResourceCreationRequest rcr, CloudMethodWorker worker, CloudMethodResourceDescription granted) {
    CloudMethodResourceDescription cmrd = rcr.getRequested();
    for (int[] typeCount : cmrd.getTypeComposition().values()) {
        currentVMCount -= typeCount[0];
    }
    for (int[] typeCount : granted.getTypeComposition().values()) {
        currentVMCount += typeCount[0];
    }
    pendingRequests.remove(rcr);
    int[][] simultaneousCounts = rcr.requestedSimultaneousTaskCount();
    for (int coreId = 0; coreId < simultaneousCounts.length; coreId++) {
        int coreSlots = 0;
        for (int implId = 0; implId < simultaneousCounts[coreId].length; implId++) {
            coreSlots = Math.max(coreSlots, simultaneousCounts[coreId][implId]);
        }
        this.pendingCoreCount[coreId] -= coreSlots;
    }
    hostedWorkers.add(worker);
}
Also used : CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription)

Aggregations

CloudMethodResourceDescription (es.bsc.compss.types.resources.description.CloudMethodResourceDescription)45 CloudInstanceTypeDescription (es.bsc.compss.types.resources.description.CloudInstanceTypeDescription)23 CloudImageDescription (es.bsc.compss.types.resources.description.CloudImageDescription)21 MethodResourceDescription (es.bsc.compss.types.resources.MethodResourceDescription)16 HashMap (java.util.HashMap)14 Test (org.junit.Test)14 CloudMethodWorker (es.bsc.compss.types.resources.CloudMethodWorker)12 FakeNode (es.bsc.compss.types.fake.FakeNode)11 CloudProvider (es.bsc.compss.types.CloudProvider)9 ResourceCreationRequest (es.bsc.compss.types.ResourceCreationRequest)7 Implementation (es.bsc.compss.types.implementations.Implementation)5 ConnectorException (es.bsc.compss.connectors.ConnectorException)4 ExtendedCloudMethodWorker (es.bsc.compss.types.ExtendedCloudMethodWorker)4 Map (java.util.Map)4 MOProfile (es.bsc.compss.scheduler.multiobjective.types.MOProfile)3 VM (es.bsc.compss.connectors.VM)2 MethodImplementation (es.bsc.compss.types.implementations.MethodImplementation)2 PerformedIncrease (es.bsc.compss.types.resources.updates.PerformedIncrease)2 VirtualResource (es.bsc.conn.types.VirtualResource)2 LinkedList (java.util.LinkedList)2