use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class RestSmartProxyImpl method uploadInputfiles.
/**
* @throws NotConnectedException
* @throws PermissionException
* @see AbstractSmartProxy#uploadInputfiles(TaskFlowJob, String)
*/
@Override
public boolean uploadInputfiles(TaskFlowJob job, String localInputFolderPath) throws NotConnectedException, PermissionException {
String userSpace = getLocalUserSpace();
String inputSpace = job.getInputSpace();
if (!inputSpace.startsWith(userSpace)) {
// NOTE: only works for USERSPACE urls
logger.warn("RestSmartProxy does not support data transfers outside USERSPACE.");
return false;
}
String remotePath = inputSpace.substring(userSpace.length() + (userSpace.endsWith("/") ? 0 : 1));
String jname = job.getName();
logger.debug("Pushing files for job " + jname + " from " + localInputFolderPath + " to " + remotePath);
TaskFlowJob tfj = job;
for (Task t : tfj.getTasks()) {
logger.debug("Pushing files for task " + t.getName());
List<String> includes = Lists.newArrayList();
List<String> excludes = Lists.newArrayList();
List<InputSelector> inputFilesList = t.getInputFilesList();
if (inputFilesList != null) {
for (InputSelector is : inputFilesList) {
addfileSelection(is.getInputFiles(), includes, excludes);
}
}
LocalDirSource source = new LocalDirSource(localInputFolderPath);
source.setIncludes(includes);
source.setExcludes(excludes);
RemoteDestination dest = new RemoteDestination(USER, remotePath);
restDataSpaceClient.upload(source, dest);
}
logger.debug("Finished push operation from " + localInputFolderPath + " to " + remotePath);
return true;
}
use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class RestSmartProxyImpl method createFolder.
@Override
protected void createFolder(String fUri) throws NotConnectedException, PermissionException {
RemoteSource remoteSource = new RemoteSource(USER, fUri);
remoteSource.setType(FileType.FOLDER);
restDataSpaceClient.create(remoteSource);
}
use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class RestSmartProxyImpl method removeJobIO.
@Override
protected void removeJobIO(Job job, String pushURL, String pullURL, String newFolderName) {
pushURL = pushURL + "/" + newFolderName;
RemoteSource remoteSource = new RemoteSource(IDataSpaceClient.Dataspace.USER, pushURL);
try {
restDataSpaceClient.delete(remoteSource);
} catch (NotConnectedException | PermissionException e) {
logger.debug("Error in removeJobIO push for job " + job.getName());
}
pullURL = pullURL + "/" + newFolderName;
remoteSource.setPath(pullURL);
try {
restDataSpaceClient.delete(remoteSource);
} catch (NotConnectedException | PermissionException e) {
logger.debug("Error in removeJobIO pull for job " + job.getName());
}
}
use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class RestSmartProxyTest method waitForJobFinishState.
private JobState waitForJobFinishState(String jobIdAsString) throws InterruptedException, NotConnectedException, UnknownJobException, PermissionException {
JobState jobState = restSmartProxy.getJobState(jobIdAsString);
Thread.sleep(ONE_SECOND);
while (jobState.getStatus().isJobAlive()) {
jobState = restSmartProxy.getJobState(jobIdAsString);
Thread.sleep(ONE_SECOND);
}
return jobState;
}
use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class SchedulerClient method getTaskResult.
@Override
public TaskResult getTaskResult(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException {
TaskResultImpl taskResult = null;
try {
TaskResultData taskResultData = restApi().taskResult(sid, jobId, taskName);
taskResult = (TaskResultImpl) toTaskResult(JobIdImpl.makeJobId(jobId), taskResultData);
if (taskResult.value() == null) {
Serializable value = restApi().valueOfTaskResult(sid, jobId, taskName);
if (value != null) {
taskResult.setValue(value);
}
}
} catch (Throwable t) {
throwUJEOrNCEOrPEOrUTE(exception(t));
}
return taskResult;
}
Aggregations