Search in sources :

Example 6 with LogicalData

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

the class NIOWorkerNode method orderStorageCopy.

private void orderStorageCopy(StorageCopy sc) {
    LOGGER.info("Order PSCO Copy for " + sc.getSourceData().getName());
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("LD Target " + sc.getTargetData());
        LOGGER.debug("FROM: " + sc.getPreferredSource());
        LOGGER.debug("TO: " + sc.getTargetLoc());
        LOGGER.debug("MUST PRESERVE: " + sc.mustPreserveSourceData());
    }
    LogicalData source = sc.getSourceData();
    LogicalData target = sc.getTargetData();
    if (target != null) {
        if (target.getName().equals(source.getName())) {
            // The source and target are the same --> IN
            newReplica(sc);
        } else {
            // The source and target are different --> OUT
            newVersion(sc);
        }
    } else {
        // Target doesn't exist yet --> INOUT
        newVersion(sc);
    }
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData)

Example 7 with LogicalData

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

the class NIOWorkerNode method sendData.

@Override
public void sendData(LogicalData ld, DataLocation source, DataLocation target, LogicalData tgtData, Transferable reason, EventListener listener) {
    if (target.getHosts().contains(Comm.getAppHost())) {
        // Order petition directly
        if (tgtData != null) {
            MultiURI u = ld.alreadyAvailable(Comm.getAppHost());
            if (u != null) {
                // Already present at the master
                reason.setDataTarget(u.getPath());
                listener.notifyEnd(null);
                return;
            }
        }
        Copy c = new DeferredCopy(ld, null, target, tgtData, reason, listener);
        Data d = new Data(ld);
        if (source != null) {
            for (MultiURI uri : source.getURIs()) {
                try {
                    NIOURI nURI = (NIOURI) uri.getInternalURI(NIOAdaptor.ID);
                    if (nURI != null) {
                        d.getSources().add(nURI);
                    }
                } catch (UnstartedNodeException une) {
                // Ignore internal URI
                }
            }
        }
        String path = target.getURIInHost(Comm.getAppHost()).getPath();
        c.setFinalTarget(path);
        ld.startCopy(c, c.getTargetLoc());
        DataRequest dr = new MasterDataRequest(c, reason.getType(), d, path);
        commManager.addTransferRequest(dr);
        commManager.requestTransfers();
    } else {
        // Request to any other
        orderCopy(new DeferredCopy(ld, source, target, tgtData, reason, listener));
    }
}
Also used : DeferredCopy(es.bsc.compss.types.data.operation.copy.DeferredCopy) MultiURI(es.bsc.compss.types.uri.MultiURI) DeferredCopy(es.bsc.compss.types.data.operation.copy.DeferredCopy) Copy(es.bsc.compss.types.data.operation.copy.Copy) StorageCopy(es.bsc.compss.types.data.operation.copy.StorageCopy) UnstartedNodeException(es.bsc.compss.exceptions.UnstartedNodeException) LogicalData(es.bsc.compss.types.data.LogicalData) Data(es.bsc.compss.nio.commands.Data) MasterDataRequest(es.bsc.compss.nio.dataRequest.MasterDataRequest) DataRequest(es.bsc.compss.nio.dataRequest.DataRequest) MasterDataRequest(es.bsc.compss.nio.dataRequest.MasterDataRequest) NIOURI(es.bsc.compss.nio.NIOURI)

Example 8 with LogicalData

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

the class NIOWorkerNode method newReplica.

private void newReplica(StorageCopy sc) {
    String targetHostname = this.getName();
    LogicalData srcLD = sc.getSourceData();
    LogicalData targetLD = sc.getTargetData();
    LOGGER.debug("Ask for new Replica of " + srcLD.getName() + " to " + targetHostname);
    // Get the PSCO to replicate
    String pscoId = srcLD.getId();
    // Get the current locations
    List<String> currentLocations = new LinkedList<>();
    try {
        currentLocations = StorageItf.getLocations(pscoId);
    } catch (StorageException se) {
        // Cannot obtain current locations from back-end
        sc.end(OpEndState.OP_FAILED, se);
        return;
    }
    if (!currentLocations.contains(targetHostname)) {
        // Perform replica
        LOGGER.debug("Performing new replica for PSCO " + pscoId);
        if (NIOTracer.isActivated()) {
            NIOTracer.emitEvent(NIOTracer.Event.STORAGE_NEWREPLICA.getId(), NIOTracer.Event.STORAGE_NEWREPLICA.getType());
        }
        try {
        // TODO: WARN New replica is NOT necessary because we can't prefetch data
        // StorageItf.newReplica(pscoId, targetHostname);
        } finally {
            if (NIOTracer.isActivated()) {
                NIOTracer.emitEvent(NIOTracer.EVENT_END, NIOTracer.Event.STORAGE_NEWREPLICA.getType());
            }
        }
    } else {
        LOGGER.debug("PSCO " + pscoId + " already present. Skip replica.");
    }
    // Update information
    sc.setFinalTarget(pscoId);
    if (targetLD != null) {
        targetLD.setId(pscoId);
    }
    // Notify successful end
    sc.end(OpEndState.OP_OK);
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData) StorageException(storage.StorageException) LinkedList(java.util.LinkedList)

Example 9 with LogicalData

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

the class NIOAdaptor method submitTask.

protected static void submitTask(NIOJob job) throws Exception {
    LOGGER.debug("NIO submitting new job " + job.getJobId());
    Resource res = job.getResource();
    NIOWorkerNode worker = (NIOWorkerNode) res.getNode();
    LogicalData[] obsoletes = res.pollObsoletes();
    List<String> obsoleteRenamings = new LinkedList<>();
    for (LogicalData ld : obsoletes) {
        obsoleteRenamings.add(worker.getWorkingDir() + File.separator + ld.getName());
    }
    RUNNING_JOBS.put(job.getJobId(), job);
    worker.submitTask(job, obsoleteRenamings);
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData) Resource(es.bsc.compss.types.resources.Resource) LinkedList(java.util.LinkedList)

Example 10 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 reason
 * @param listener
 */
public void getData(String dataId, DataLocation target, Transferable reason, EventListener listener) {
    LogicalData srcData = Comm.getData(dataId);
    getData(srcData, target, srcData, reason, listener);
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData)

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