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));
}
}
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);
}
}
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);
}
}
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();
}
Aggregations