use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method getTaskStates.
@Override
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException {
RestPage<TaskStateData> page = null;
SortSpecifierContainer sortContainer = new SortSpecifierContainer(sortParams.toString());
try {
page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit, sortContainer);
} catch (NotConnectedRestException e) {
throw new NotConnectedException(e);
} catch (PermissionRestException e) {
throw new PermissionException(e);
}
List<TaskState> lTaskStates = new ArrayList<TaskState>(page.getList().size());
for (TaskStateData taskStateData : page.getList()) {
lTaskStates.add(new TaskStateImpl(taskStateData));
}
return new Page<TaskState>(lTaskStates, page.getSize());
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class RestSchedulerJobTaskTest method cleanScheduler.
private static void cleanScheduler() throws NotConnectedException, PermissionException, UnknownJobException {
Scheduler scheduler = RestFuncTHelper.getScheduler();
SchedulerState state = scheduler.getState();
Iterable<JobState> jobs = Iterables.concat(state.getPendingJobs(), state.getRunningJobs(), state.getFinishedJobs());
for (JobState jobState : jobs) {
JobId jobId = jobState.getId();
scheduler.killJob(jobId);
scheduler.removeJob(jobId);
}
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerStateRest method enableRemoteVisualization.
@Override
public void enableRemoteVisualization(String sessionId, String jobId, String taskName, String connectionString) throws RestException {
Scheduler s = checkAccess(sessionId, "PUT jobs/" + jobId + PATH_TASKS + taskName + "/visualization");
Session ss = sessionStore.get(sessionId);
try {
ss.getScheduler().enableRemoteVisualization(jobId, taskName, connectionString);
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (PermissionException e) {
throw new PermissionRestException(e);
} catch (UnknownJobException e) {
throw new UnknownJobRestException(e);
} catch (UnknownTaskException e) {
throw new UnknownTaskRestException(e);
}
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerStateRest method registerService.
@Override
public void registerService(String sessionId, String jobId, int serviceInstanceid, boolean enableActions) throws RestException {
Scheduler s = checkAccess(sessionId, "POST jobs/" + jobId + PATH_SERVICES);
Session ss = sessionStore.get(sessionId);
try {
ss.getScheduler().registerService(jobId, serviceInstanceid, enableActions);
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (PermissionException e) {
throw new PermissionRestException(e);
} catch (UnknownJobException e) {
throw new UnknownJobRestException(e);
}
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerStateRest method detachService.
@Override
public void detachService(String sessionId, String jobId, int serviceInstanceid) throws RestException {
Scheduler s = checkAccess(sessionId, "DELETE jobs/" + jobId + PATH_SERVICES);
Session ss = sessionStore.get(sessionId);
try {
ss.getScheduler().detachService(jobId, serviceInstanceid);
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (PermissionException e) {
throw new PermissionRestException(e);
} catch (UnknownJobException e) {
throw new UnknownJobRestException(e);
}
}
Aggregations