use of es.bsc.compss.types.COMPSsNode 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.COMPSsNode in project compss by bsc-wdc.
the class Resource method retrieveData.
/**
* Retrieves all the data from the Resource
*
* @param saveUniqueData
*/
public void retrieveData(boolean saveUniqueData) {
if (DEBUG) {
LOGGER.debug("Retrieving data resource " + this.getName());
}
Semaphore sem = new Semaphore(0);
SafeCopyListener listener = new SafeCopyListener(sem);
Set<LogicalData> lds = getAllDataFromHost();
Map<String, String> disks = SharedDiskManager.terminate(this);
COMPSsNode masterNode = Comm.getAppHost().getNode();
for (LogicalData ld : lds) {
ld.notifyToInProgressCopiesEnd(listener);
DataLocation lastLoc = ld.removeHostAndCheckLocationToSave(this, disks);
if (lastLoc != null && saveUniqueData) {
listener.addOperation();
DataLocation safeLoc = null;
String safePath = Protocol.FILE_URI.getSchema() + Comm.getAppHost().getTempDirPath() + ld.getName();
try {
SimpleURI uri = new SimpleURI(safePath);
safeLoc = DataLocation.createLocation(Comm.getAppHost(), uri);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + safePath, e);
}
masterNode.obtainData(ld, lastLoc, safeLoc, ld, new SafeCopyTransferable(), listener);
}
}
if (DEBUG) {
LOGGER.debug("Waiting for finishing saving copies for " + this.getName());
}
listener.enable();
try {
sem.acquire();
} catch (InterruptedException ex) {
LOGGER.error("Error waiting for files in resource " + getName() + " to get saved");
}
if (DEBUG) {
LOGGER.debug("Unique files saved for " + this.getName());
}
if (this.getType() != Type.SERVICE) {
shutdownExecutionManager();
if (Tracer.isActivated()) {
if (node.generatePackage()) {
getTracingPackageToMaster();
if (DEBUG) {
LOGGER.debug("Tracing package obtained for " + this.getName());
}
}
}
if (DEBUG) {
if (node.generateWorkersDebugInfo()) {
getWorkersDebugInfo();
LOGGER.debug("Workers Debug files obtained for " + this.getName());
}
}
}
}
use of es.bsc.compss.types.COMPSsNode in project compss by bsc-wdc.
the class ServiceInstance method obtainData.
@Override
public void obtainData(LogicalData ld, DataLocation source, DataLocation target, LogicalData tgtData, Transferable reason, EventListener listener) {
// Delegate on the master to obtain the data value
String path = target.getProtocol().getSchema() + target.getPath();
DataLocation tgtLoc = null;
try {
SimpleURI uri = new SimpleURI(path);
tgtLoc = DataLocation.createLocation(Comm.getAppHost(), uri);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + path, e);
}
COMPSsNode node = Comm.getAppHost().getNode();
node.obtainData(ld, source, tgtLoc, tgtData, reason, listener);
}
use of es.bsc.compss.types.COMPSsNode in project compss by bsc-wdc.
the class WSJob method toString.
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
buffer.append("[[Job id: ").append(getJobId()).append("]");
buffer.append(", ").append(taskParams.toString());
String name = "";
COMPSsNode node = getResourceNode();
name = node.getName();
buffer.append(", [Target URL: ").append(name).append("]]");
return buffer.toString();
}
use of es.bsc.compss.types.COMPSsNode in project compss by bsc-wdc.
the class Resource method getWorkersDebugInfo.
private void getWorkersDebugInfo() {
if (DEBUG) {
LOGGER.debug("Copying Workers Information");
}
COMPSsNode masterNode = Comm.getAppHost().getNode();
Semaphore sem = new Semaphore(0);
WorkersDebugInformationListener wdil = new WorkersDebugInformationListener(sem);
// Get Worker output
wdil.addOperation();
String outFileName = "worker_" + getName() + ".out";
SimpleURI outFileOrigin = node.getCompletePath(DataType.FILE_T, "log" + File.separator + "static_" + outFileName);
String outFileTarget = Protocol.FILE_URI.getSchema() + Comm.getAppHost().getWorkersDirPath() + File.separator + outFileName;
DataLocation outSource = null;
try {
outSource = DataLocation.createLocation(this, outFileOrigin);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + outFileOrigin.toString(), e);
}
DataLocation outTarget = null;
try {
SimpleURI uri = new SimpleURI(outFileTarget);
outTarget = DataLocation.createLocation(Comm.getAppHost(), uri);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + outFileTarget);
}
LOGGER.debug("- Source: " + outFileOrigin);
LOGGER.debug("- Target: " + outFileTarget);
masterNode.obtainData(new LogicalData("workerOut" + this.getName()), outSource, outTarget, new LogicalData("workerOut" + this.getName()), new WorkersDebugInfoCopyTransferable(), wdil);
// Get Worker error
wdil.addOperation();
String errFileName = "worker_" + getName() + ".err";
SimpleURI errFileOrigin = node.getCompletePath(DataType.FILE_T, "log" + File.separator + "static_" + errFileName);
String errFileTarget = Protocol.FILE_URI.getSchema() + Comm.getAppHost().getWorkersDirPath() + File.separator + errFileName;
DataLocation errSource = null;
try {
errSource = DataLocation.createLocation(this, errFileOrigin);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + errFileOrigin.toString(), e);
}
DataLocation errTarget = null;
try {
SimpleURI uri = new SimpleURI(errFileTarget);
errTarget = DataLocation.createLocation(Comm.getAppHost(), uri);
} catch (Exception e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + errFileTarget);
}
LOGGER.debug("- Source: " + errFileOrigin);
LOGGER.debug("- Target: " + errFileTarget);
masterNode.obtainData(new LogicalData("workerErr" + this.getName()), errSource, errTarget, new LogicalData("workerErr" + this.getName()), new WorkersDebugInfoCopyTransferable(), wdil);
// Wait transfers
wdil.enable();
try {
sem.acquire();
} catch (InterruptedException ex) {
LOGGER.error("Error waiting for worker debug files in resource " + getName() + " to get saved");
}
LOGGER.debug("Worker files from resource " + getName() + "received");
}
Aggregations