use of es.bsc.compss.types.data.transferable.TracingCopyTransferable in project compss by bsc-wdc.
the class Resource method getTracingPackageToMaster.
private void getTracingPackageToMaster() {
COMPSsNode masterNode = Comm.getAppHost().getNode();
Semaphore sem = new Semaphore(0);
String fileName = getName() + "_compss_trace.tar.gz";
SimpleURI fileOriginURI = node.getCompletePath(DataType.FILE_T, fileName);
if (DEBUG) {
LOGGER.debug("Copying tracing package from : " + fileOriginURI.getPath() + ",to : " + Comm.getAppHost().getAppLogDirPath() + "trace" + File.separator + fileName);
}
TracingCopyListener tracingListener = new TracingCopyListener(sem);
tracingListener.addOperation();
// Source data location
DataLocation source;
try {
source = DataLocation.createLocation(this, fileOriginURI);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + fileOriginURI.getPath(), e);
return;
}
// Target data location
DataLocation tgt;
String targetPath = Protocol.FILE_URI.getSchema() + Comm.getAppHost().getAppLogDirPath() + "trace" + File.separator + fileName;
try {
SimpleURI uri = new SimpleURI(targetPath);
tgt = DataLocation.createLocation(Comm.getAppHost(), uri);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + targetPath);
return;
}
// Ask for data
masterNode.obtainData(new LogicalData("tracing" + this.getName()), source, tgt, new LogicalData("tracing" + this.getName()), new TracingCopyTransferable(), tracingListener);
tracingListener.enable();
try {
sem.acquire();
} catch (InterruptedException ex) {
LOGGER.error("Error waiting for tracing files in resource " + getName() + " to get saved");
}
if (DEBUG) {
LOGGER.debug("Removing " + this.getName() + " tracing temporary files");
}
File f = null;
try {
f = new File(source.getPath());
if (!f.delete()) {
LOGGER.error("Unable to remove tracing temporary files of node " + this.getName());
}
} catch (Exception e) {
LOGGER.error("Unable to remove tracing temporary files of node " + this.getName(), e);
}
}
use of es.bsc.compss.types.data.transferable.TracingCopyTransferable in project compss by bsc-wdc.
the class Tracer method transferMasterPackage.
private static void transferMasterPackage() {
if (DEBUG) {
LOGGER.debug("Tracing: Transferring master package");
}
// Create source and target locations for tar.gz file
String filename = "master_compss_trace.tar.gz";
DataLocation source = null;
String sourcePath = DataLocation.Protocol.FILE_URI.getSchema() + filename;
try {
SimpleURI uri = new SimpleURI(sourcePath);
source = DataLocation.createLocation(Comm.getAppHost(), uri);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + sourcePath, e);
}
DataLocation target = null;
String targetPath = DataLocation.Protocol.FILE_URI.getSchema() + traceDirPath + filename;
try {
SimpleURI uri = new SimpleURI(targetPath);
target = DataLocation.createLocation(Comm.getAppHost(), uri);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + targetPath, e);
}
// Ask for data
Semaphore sem = new Semaphore(0);
TracingCopyListener tracingListener = new TracingCopyListener(sem);
tracingListener.addOperation();
Comm.getAppHost().getNode().obtainData(new LogicalData("tracing master package"), source, target, new LogicalData("tracing master package"), new TracingCopyTransferable(), tracingListener);
// Wait for data
tracingListener.enable();
try {
sem.acquire();
} catch (InterruptedException ex) {
ErrorManager.warn("Error waiting for tracing files in master to get saved");
}
}
Aggregations