Search in sources :

Example 11 with Resource

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

the class PersistentLocation method getHosts.

@Override
public List<Resource> getHosts() {
    LOGGER.debug("Get PSCO locations for " + this.id);
    // Retrieve locations from Back-end
    List<String> locations = null;
    try {
        locations = StorageItf.getLocations(this.id);
    } catch (StorageException e) {
        ErrorManager.error("ERROR: Cannot retrieve locations of " + this.id + " from Storage Back-end");
    }
    if (locations == null) {
        ErrorManager.error("ERROR: Cannot retrieve locations of " + this.id + " from Storage Back-end");
    }
    // Get hosts
    List<Resource> hosts = new LinkedList<>();
    for (String hostName : locations) {
        Resource host = Resource.getResource(hostName);
        if (host != null) {
            hosts.add(host);
        } else {
            LOGGER.warn("Storage Back-End returned non-registered host " + hostName);
        }
    }
    return hosts;
}
Also used : Resource(es.bsc.compss.types.resources.Resource) StorageException(storage.StorageException) LinkedList(java.util.LinkedList)

Example 12 with Resource

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

the class SharedLocation method getURIs.

@Override
public List<MultiURI> getURIs() {
    List<MultiURI> uris = new LinkedList<>();
    List<Resource> resList = SharedDiskManager.getAllMachinesfromDisk(this.diskName);
    Resource[] resources;
    synchronized (resList) {
        resources = resList.toArray(new Resource[resList.size()]);
    }
    for (Resource host : resources) {
        String diskPath = SharedDiskManager.getMounpoint(host, this.diskName);
        if (!diskPath.endsWith(File.separator)) {
            diskPath = diskPath + File.separator;
        }
        uris.add(new MultiURI(this.protocol, host, diskPath + this.path));
    }
    return uris;
}
Also used : MultiURI(es.bsc.compss.types.uri.MultiURI) Resource(es.bsc.compss.types.resources.Resource) LinkedList(java.util.LinkedList)

Aggregations

Resource (es.bsc.compss.types.resources.Resource)12 LinkedList (java.util.LinkedList)6 MultiURI (es.bsc.compss.types.uri.MultiURI)5 LogicalData (es.bsc.compss.types.data.LogicalData)3 DataLocation (es.bsc.compss.types.data.location.DataLocation)3 SimpleURI (es.bsc.compss.types.uri.SimpleURI)2 File (java.io.File)2 StorageException (storage.StorageException)2 CopyException (es.bsc.compss.exceptions.CopyException)1 Data (es.bsc.compss.nio.commands.Data)1 CloudProvider (es.bsc.compss.types.CloudProvider)1 DataAccessId (es.bsc.compss.types.data.DataAccessId)1 DataInstanceId (es.bsc.compss.types.data.DataInstanceId)1 Copy (es.bsc.compss.types.data.operation.copy.Copy)1 DependencyParameter (es.bsc.compss.types.parameter.DependencyParameter)1 Parameter (es.bsc.compss.types.parameter.Parameter)1 CloudMethodWorker (es.bsc.compss.types.resources.CloudMethodWorker)1 CloudInstanceTypeDescription (es.bsc.compss.types.resources.description.CloudInstanceTypeDescription)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1