Search in sources :

Example 1 with LogicalData

use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.

the class Comm method registerValue.

/**
 * Registers a new value @value for the data with id @dataId dataId must exist
 *
 * @param dataId
 * @param value
 * @return
 */
public static synchronized LogicalData registerValue(String dataId, Object value) {
    LOGGER.debug("Register value " + value + " for data " + dataId);
    String targetPath = Protocol.OBJECT_URI.getSchema() + dataId;
    DataLocation location = null;
    try {
        SimpleURI uri = new SimpleURI(targetPath);
        location = DataLocation.createLocation(appHost, uri);
    } catch (IOException e) {
        ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + targetPath, e);
    }
    LogicalData logicalData = data.get(dataId);
    logicalData.addLocation(location);
    logicalData.setValue(value);
    // Register PSCO Location if needed it's PSCO and it's persisted
    if (value instanceof StubItf) {
        String id = ((StubItf) value).getID();
        if (id != null) {
            Comm.registerPSCO(dataId, id);
        }
    }
    return logicalData;
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData) SimpleURI(es.bsc.compss.types.uri.SimpleURI) StubItf(storage.StubItf) DataLocation(es.bsc.compss.types.data.location.DataLocation) IOException(java.io.IOException)

Example 2 with LogicalData

use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.

the class Comm method clearValue.

/**
 * Clears the value of the data id @dataId
 *
 * @param dataId
 * @return
 */
public static synchronized Object clearValue(String dataId) {
    LOGGER.debug("Clear value of data " + dataId);
    LogicalData logicalData = data.get(dataId);
    return logicalData.removeValue();
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData)

Example 3 with LogicalData

use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.

the class Comm method registerPSCO.

/**
 * Registers a new PSCO id @id for the data with id @dataId dataId must exist
 *
 * @param dataId
 * @param id
 * @return
 */
public static synchronized LogicalData registerPSCO(String dataId, String id) {
    String targetPath = Protocol.PERSISTENT_URI.getSchema() + id;
    DataLocation location = null;
    try {
        SimpleURI uri = new SimpleURI(targetPath);
        location = DataLocation.createLocation(appHost, uri);
    } catch (IOException ioe) {
        ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + targetPath, ioe);
    }
    LogicalData logicalData = data.get(dataId);
    logicalData.addLocation(location);
    return logicalData;
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData) SimpleURI(es.bsc.compss.types.uri.SimpleURI) DataLocation(es.bsc.compss.types.data.location.DataLocation) IOException(java.io.IOException)

Example 4 with LogicalData

use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.

the class Comm method registerLocation.

/**
 * Registers a new location @location for the data with id @dataId dataId must exist
 *
 * @param dataId
 * @param location
 * @return
 */
public static synchronized LogicalData registerLocation(String dataId, DataLocation location) {
    LOGGER.debug("Registering new Location for data " + dataId + ":");
    LOGGER.debug("  * Location: " + location);
    LogicalData logicalData = data.get(dataId);
    logicalData.addLocation(location);
    return logicalData;
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData)

Example 5 with LogicalData

use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.

the class Comm method removeData.

/**
 * Removes the data with id @renaming
 *
 * @param renaming
 */
public static synchronized void removeData(String renaming) {
    LOGGER.debug("Remove data " + renaming);
    LogicalData ld = data.remove(renaming);
    ld.isObsolete();
    for (DataLocation dl : ld.getLocations()) {
        MultiURI uri = dl.getURIInHost(appHost);
        if (uri != null) {
            File f = new File(uri.getPath());
            if (f.exists()) {
                LOGGER.info("Deleting file " + f.getAbsolutePath());
                if (!f.delete()) {
                    LOGGER.error("Cannot delete file " + f.getAbsolutePath());
                }
            }
        }
    }
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData) MultiURI(es.bsc.compss.types.uri.MultiURI) DataLocation(es.bsc.compss.types.data.location.DataLocation) File(java.io.File)

Aggregations

LogicalData (es.bsc.compss.types.data.LogicalData)27 DataLocation (es.bsc.compss.types.data.location.DataLocation)9 UnstartedNodeException (es.bsc.compss.exceptions.UnstartedNodeException)6 SimpleURI (es.bsc.compss.types.uri.SimpleURI)6 MultiURI (es.bsc.compss.types.uri.MultiURI)5 Semaphore (java.util.concurrent.Semaphore)5 InitNodeException (es.bsc.compss.exceptions.InitNodeException)4 COMPSsNode (es.bsc.compss.types.COMPSsNode)3 Copy (es.bsc.compss.types.data.operation.copy.Copy)3 Resource (es.bsc.compss.types.resources.Resource)3 IOException (java.io.IOException)3 LinkedList (java.util.LinkedList)3 Data (es.bsc.compss.nio.commands.Data)2 DataRequest (es.bsc.compss.nio.dataRequest.DataRequest)2 MasterDataRequest (es.bsc.compss.nio.dataRequest.MasterDataRequest)2 DataAccessId (es.bsc.compss.types.data.DataAccessId)2 TracingCopyListener (es.bsc.compss.types.data.listener.TracingCopyListener)2 TracingCopyTransferable (es.bsc.compss.types.data.transferable.TracingCopyTransferable)2 DependencyParameter (es.bsc.compss.types.parameter.DependencyParameter)2 Parameter (es.bsc.compss.types.parameter.Parameter)2