Search in sources :

Example 26 with LogicalData

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

the class Resource method getData.

/**
 * Retrieves a given data
 *
 * @param dataId
 * @param target
 * @param tgtData
 * @param reason
 * @param listener
 */
public void getData(String dataId, DataLocation target, LogicalData tgtData, Transferable reason, EventListener listener) {
    LogicalData ld = Comm.getData(dataId);
    getData(ld, target, tgtData, reason, listener);
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData)

Example 27 with LogicalData

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

the class AccessProcessor method obtainObject.

/**
 * Adds a request to obtain an object from a worker to the master
 *
 * @param oaId
 * @return
 */
private Object obtainObject(DataAccessId oaId) {
    LOGGER.debug("Obtain object with id " + oaId);
    // Ask for the object
    Semaphore sem = new Semaphore(0);
    TransferObjectRequest tor = new TransferObjectRequest(oaId, sem);
    if (!requestQueue.offer(tor)) {
        ErrorManager.error(ERROR_QUEUE_OFFER + "obtain object");
    }
    // Wait for response
    sem.acquireUninterruptibly();
    // Get response
    Object oUpdated = tor.getResponse();
    if (oUpdated == null) {
        /*
             * The Object didn't come from a WS but was transferred from a worker, we load it from its storage (file or
             * persistent)
             */
        LogicalData ld = tor.getLogicalDataTarget();
        try {
            ld.loadFromStorage();
            oUpdated = ld.getValue();
        } catch (CannotLoadException e) {
            LOGGER.fatal(ERROR_OBJECT_LOAD_FROM_STORAGE + ": " + ((ld == null) ? "null" : ld.getName()), e);
            ErrorManager.fatal(ERROR_OBJECT_LOAD_FROM_STORAGE + ": " + ((ld == null) ? "null" : ld.getName()), e);
        }
    }
    return oUpdated;
}
Also used : TransferObjectRequest(es.bsc.compss.types.request.ap.TransferObjectRequest) LogicalData(es.bsc.compss.types.data.LogicalData) CannotLoadException(es.bsc.compss.exceptions.CannotLoadException) Semaphore(java.util.concurrent.Semaphore)

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