use of org.ow2.proactive.scheduler.common.exception.NotConnectedException 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;
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method getJobResult.
@Override
public JobResult getJobResult(String jobId) throws NotConnectedException, PermissionException, UnknownJobException {
JobResult jobResult = null;
try {
JobResultData jobResultData = restApi().jobResult(sid, jobId);
jobResult = toJobResult(jobResultData);
} catch (Exception e) {
throwUJEOrNCEOrPE(e);
}
return jobResult;
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method getStatus.
@Override
public SchedulerStatus getStatus() throws NotConnectedException, PermissionException {
SchedulerStatus status = null;
try {
SchedulerStatusData schedulerStatus = restApi().getSchedulerStatus(sid);
status = SchedulerStatus.valueOf(schedulerStatus.name());
} catch (Exception e) {
throwNCEOrPE(e);
}
return status;
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method submit.
@Override
public JobId submit(Job job) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
JobIdData jobIdData = null;
try {
InputStream is = (new Job2XMLTransformer()).jobToxml((TaskFlowJob) job);
jobIdData = restApiClient().submitXml(sid, is);
} catch (Exception e) {
throwNCEOrPEOrSCEOrJCE(e);
}
return jobId(jobIdData);
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class DataSpaceClient method create.
@Override
public boolean create(IRemoteSource source) throws NotConnectedException, PermissionException {
if (log.isDebugEnabled()) {
log.debug("Trying to create file " + source);
}
StringBuffer uriTmpl = (new StringBuffer()).append(restDataspaceUrl).append(source.getDataspace().value());
ResteasyClient client = new ResteasyClientBuilder().httpEngine(httpEngine).build();
ResteasyWebTarget target = client.target(uriTmpl.toString()).path(source.getPath());
Response response = null;
try {
Invocation.Builder request = target.request();
request.header("sessionid", sessionId);
Form form = new Form();
form.param("mimetype", source.getType().getMimeType());
response = request.post(Entity.form(form));
if (response.getStatus() != HttpURLConnection.HTTP_OK) {
if (response.getStatus() == HttpURLConnection.HTTP_UNAUTHORIZED) {
throw new NotConnectedException("User not authenticated or session timeout.");
} else {
throw new RuntimeException("Cannot create file(s). Status code:" + response.getStatus());
}
}
if (log.isDebugEnabled()) {
log.debug("File creation " + source + " performed with success");
}
return true;
} finally {
if (response != null) {
response.close();
}
}
}
Aggregations