Search in sources :

Example 1 with MasterDataRequest

use of es.bsc.compss.nio.dataRequest.MasterDataRequest 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 2 with MasterDataRequest

use of es.bsc.compss.nio.dataRequest.MasterDataRequest in project compss by bsc-wdc.

the class NIOAdaptor method handleRequestedDataNotAvailableError.

@Override
public void handleRequestedDataNotAvailableError(List<DataRequest> failedRequests, String dataId) {
    for (DataRequest dr : failedRequests) {
        MasterDataRequest mdr = (MasterDataRequest) dr;
        Copy c = (Copy) mdr.getOperation();
        c.getSourceData().finishedCopy(c);
        // Notify the copy has failed
        c.end(DataOperation.OpEndState.OP_FAILED);
    }
}
Also used : Copy(es.bsc.compss.types.data.operation.copy.Copy) MasterDataRequest(es.bsc.compss.nio.dataRequest.MasterDataRequest) DataRequest(es.bsc.compss.nio.dataRequest.DataRequest) MasterDataRequest(es.bsc.compss.nio.dataRequest.MasterDataRequest)

Example 3 with MasterDataRequest

use of es.bsc.compss.nio.dataRequest.MasterDataRequest in project compss by bsc-wdc.

the class NIOAdaptor method receivedValue.

@Override
public void receivedValue(Destination type, String dataId, Object object, List<DataRequest> achievedRequests) {
    for (DataRequest dr : achievedRequests) {
        MasterDataRequest mdr = (MasterDataRequest) dr;
        Copy c = (Copy) mdr.getOperation();
        DataLocation actualLocation = c.getSourceData().finishedCopy(c);
        LogicalData tgtData = c.getTargetData();
        if (tgtData != null) {
            tgtData.addLocation(actualLocation);
            if (object != null) {
                tgtData.setValue(object);
            }
        }
        c.end(DataOperation.OpEndState.OP_OK);
    }
    if (NIOTracer.isActivated()) {
        NIOTracer.emitDataTransferEvent(NIOTracer.TRANSFER_END);
    }
}
Also used : LogicalData(es.bsc.compss.types.data.LogicalData) Copy(es.bsc.compss.types.data.operation.copy.Copy) DataLocation(es.bsc.compss.types.data.location.DataLocation) MasterDataRequest(es.bsc.compss.nio.dataRequest.MasterDataRequest) DataRequest(es.bsc.compss.nio.dataRequest.DataRequest) MasterDataRequest(es.bsc.compss.nio.dataRequest.MasterDataRequest)

Example 4 with MasterDataRequest

use of es.bsc.compss.nio.dataRequest.MasterDataRequest in project compss by bsc-wdc.

the class NIOAdaptor method requestData.

public void requestData(Copy c, DataType paramType, Data d, String path) {
    DataRequest dr = new MasterDataRequest(c, paramType, d, path);
    addTransferRequest(dr);
    requestTransfers();
}
Also used : MasterDataRequest(es.bsc.compss.nio.dataRequest.MasterDataRequest) DataRequest(es.bsc.compss.nio.dataRequest.DataRequest) MasterDataRequest(es.bsc.compss.nio.dataRequest.MasterDataRequest)

Aggregations

DataRequest (es.bsc.compss.nio.dataRequest.DataRequest)4 MasterDataRequest (es.bsc.compss.nio.dataRequest.MasterDataRequest)4 Copy (es.bsc.compss.types.data.operation.copy.Copy)3 LogicalData (es.bsc.compss.types.data.LogicalData)2 UnstartedNodeException (es.bsc.compss.exceptions.UnstartedNodeException)1 NIOURI (es.bsc.compss.nio.NIOURI)1 Data (es.bsc.compss.nio.commands.Data)1 DataLocation (es.bsc.compss.types.data.location.DataLocation)1 DeferredCopy (es.bsc.compss.types.data.operation.copy.DeferredCopy)1 StorageCopy (es.bsc.compss.types.data.operation.copy.StorageCopy)1 MultiURI (es.bsc.compss.types.uri.MultiURI)1