use of org.objectweb.proactive.extensions.dataspaces.exceptions.FileSystemException in project scheduling by ow2-proactive.
the class TaskLauncher method copyTaskLogsToUserSpace.
private void copyTaskLogsToUserSpace(File taskLogFile, TaskDataspaces dataspaces) {
if (initializer.isPreciousLogs()) {
try {
FileSelector taskLogFileSelector = new FileSelector(taskLogFile.getName());
taskLogFileSelector.setIncludes(new TaskLoggerRelativePathGenerator(taskId).getRelativePath());
dataspaces.copyScratchDataToOutput(Collections.singletonList(new OutputSelector(taskLogFileSelector, OutputAccessMode.TransferToUserSpace)));
} catch (FileSystemException e) {
logger.warn("Cannot copy logs of task to user data spaces", e);
}
}
}
use of org.objectweb.proactive.extensions.dataspaces.exceptions.FileSystemException in project scheduling by ow2-proactive.
the class TaskProActiveDataspaces method setFolderRightsForRunAsUserMode.
/**
* Sets open file permissions for folder copied in RunAsMe mode.
* The method will set as well recursively the permissions on the parents folder.
*/
private void setFolderRightsForRunAsUserMode(DataSpacesFileObject object) throws FileSystemException {
if (runAsUser) {
setRWPermission(object);
if (linuxOS) {
object.setExecutable(true, false);
}
DataSpacesFileObject parentObject = null;
try {
parentObject = object.getParent();
} catch (Exception ignored) {
// in case getParent throws an exception instead of null, we prefer to ignore it and not propagate the permissions further.
}
if (parentObject != null) {
setFolderRightsForRunAsUserMode(parentObject);
}
}
}
use of org.objectweb.proactive.extensions.dataspaces.exceptions.FileSystemException in project scheduling by ow2-proactive.
the class TaskProActiveDataspaces method addFilesResultToList.
private void addFilesResultToList(List<Future<List<DataSpacesFileObject>>> futures, ArrayList<DataSpacesFileObject> results) throws InterruptedException, FileSystemException {
StringBuilder message = new StringBuilder();
String nl = System.lineSeparator();
for (Future<List<DataSpacesFileObject>> future : futures) {
try {
results.addAll(future.get());
} catch (InterruptedException | ExecutionException e) {
logger.error("Exception while selecting input files to copy ", e);
message.append(StackTraceUtil.getStackTrace(e)).append(nl);
}
}
if (message.length() > 0) {
throw new FileSystemException("Exception(s) occurred when selecting input files to copy: " + nl + message.toString());
}
}
use of org.objectweb.proactive.extensions.dataspaces.exceptions.FileSystemException in project scheduling by ow2-proactive.
the class TaskProActiveDataspaces method createTaskIdFolder.
private DataSpacesFileObject createTaskIdFolder(DataSpacesFileObject space, String spaceName) {
if (space != null) {
String realURI = space.getRealURI();
// Look for the TASKID pattern at the end of the dataspace URI
if (realURI.contains(SchedulerConstants.TASKID_DIR_DEFAULT_NAME)) {
// resolve the taskid subfolder
DataSpacesFileObject tidOutput;
try {
tidOutput = space.resolveFile(taskId.toString());
// create this subfolder
tidOutput.createFolder();
} catch (FileSystemException e) {
logger.info("Error when creating the TASKID folder in " + realURI, e);
logger.info(spaceName + " space is disabled");
return null;
}
// assign it to the space
space = tidOutput;
logger.info(SchedulerConstants.TASKID_DIR_DEFAULT_NAME + " pattern found, changed " + spaceName + " space to : " + space.getRealURI());
}
}
return space;
}
use of org.objectweb.proactive.extensions.dataspaces.exceptions.FileSystemException in project scheduling by ow2-proactive.
the class TaskProActiveDataspaces method createFolderHierarchySequentially.
/*
* Create the folder hierarchy and select the files to copy
* from the specified list of FileObjects.
*/
protected void createFolderHierarchySequentially(DataSpacesFileObject destination, String spaceUri, List<DataSpacesFileObject> spaceFiles, Map<String, DataSpacesFileObject> filesToCopy) throws FileSystemException {
boolean isDebugEnabled = logger.isDebugEnabled();
boolean isFolderHierarchyCreationEnabled = isCreateFolderHierarchySequentiallyEnabled();
long startTime = System.currentTimeMillis();
for (DataSpacesFileObject fileObject : spaceFiles) {
String relativePath = relativize(spaceUri, fileObject);
if (isFolderHierarchyCreationEnabled) {
try {
DataSpacesFileObject target = destination.resolveFile(relativePath);
createFolderHierarchy(isDebugEnabled, fileObject, target);
} catch (FileSystemException e) {
String message = "Could not create folder hierarchy for " + relativePath + " on " + destination.getRealURI();
logger.warn(message);
logDataspacesStatus(message, DataspacesStatusLevel.WARNING);
}
}
DataSpacesFileObject oldFileObject = filesToCopy.put(relativePath, fileObject);
if (oldFileObject != null) {
String message = fileObject.getRealURI() + " will be copied instead of " + oldFileObject.getRealURI() + ".\n " + "Precedence order is output space, input space, user space, global space.";
logger.warn(message);
logDataspacesStatus(message, DataspacesStatusLevel.WARNING);
}
}
logger.info("Time needed to build folder hierarchy: " + (System.currentTimeMillis() - startTime) + " ms");
}
Aggregations