use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontend method getTaskIds.
@Override
public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException {
RestPageParameters params = new RestPageParameters(frontendState, "getTaskIds", from, to, mytasks, running, pending, finished, offset, limit, taskTag, SortSpecifierContainer.EMPTY_CONTAINER);
Page<TaskInfo> pTaskInfo;
pTaskInfo = dbManager.getTasks(params.getFrom(), params.getTo(), params.getTag(), params.getOffset(), params.getLimit(), params.getUserName(), params.isPending(), params.isRunning(), params.isFinished());
List<TaskId> lTaskId = new ArrayList<TaskId>(pTaskInfo.getList().size());
for (TaskInfo taskInfo : pTaskInfo.getList()) {
lTaskId.add(taskInfo.getTaskId());
}
return new Page<TaskId>(lTaskId, pTaskInfo.getSize());
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontendState method checkChangePolicy.
synchronized void checkChangePolicy() throws NotConnectedException, PermissionException {
UniqueID id = checkAccess();
UserIdentificationImpl ident = identifications.get(id).getUser();
// renew session for this user
renewUserSession(id, ident);
try {
ident.checkPermission(new ChangePolicyPermission(), ident.getUsername() + " does not have permissions to change the policy of the scheduler");
} catch (PermissionException ex) {
logger.info(ex.getMessage());
throw ex;
}
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontendState method jobSubmitted.
synchronized void jobSubmitted(InternalJob job, UserIdentificationImpl ident) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
// put the job inside the frontend management list
jobs.put(job.getId(), new IdentifiedJob(job.getId(), ident, job.getGenericInformation()));
// increase number of submit for this user
ident.addSubmit();
// send update user event
usersUpdated(new NotificationData<UserIdentification>(SchedulerEvent.USERS_UPDATE, ident));
jlogger.info(job.getId(), "submitted: name '" + job.getName() + "', tasks '" + job.getTotalNumberOfTasks() + "', owner '" + job.getOwner() + "'");
try {
jlogger.info(job.getId(), job.display());
} catch (Exception e) {
jlogger.error(job.getId(), "Error while displaying the job :", e);
}
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerStateRest method jobsInfo.
/**
* Returns a subset of the scheduler state, including pending, running,
* finished jobs (in this particular order). each jobs is described using -
* its id - its owner - the JobInfo class
*
* @param index
* optional, if a sublist has to be returned the index of the
* sublist
* @param limit
* optional, if a sublist has to be returned, the limit of the
* sublist
* @param sessionId
* a valid session id
* @return a list of UserJobData
*/
@Override
@GET
@Path("jobsinfo")
@Produces({ "application/json", "application/xml" })
public RestPage<UserJobData> jobsInfo(@HeaderParam("sessionid") String sessionId, @QueryParam("index") @DefaultValue("-1") int index, @QueryParam("limit") @DefaultValue("-1") int limit) throws PermissionRestException, NotConnectedRestException {
try {
Scheduler s = checkAccess(sessionId, "/scheduler/jobsinfo");
Page<JobInfo> page = s.getJobs(index, limit, new JobFilterCriteria(false, true, true, true), DEFAULT_JOB_SORT_PARAMS);
List<UserJobData> userJobInfoList = new ArrayList<UserJobData>(page.getList().size());
for (JobInfo jobInfo : page.getList()) {
userJobInfoList.add(new UserJobData(mapper.map(jobInfo, JobInfoData.class)));
}
return new RestPage<UserJobData>(userJobInfoList, page.getSize());
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (PermissionException e) {
throw new PermissionRestException(e);
}
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerStateRest method putThirdPartyCredential.
@Override
public void putThirdPartyCredential(String sessionId, String key, String value) throws NotConnectedRestException, PermissionRestException, SchedulerRestException {
try {
Scheduler s = checkAccess(sessionId);
s.putThirdPartyCredential(key, value);
} catch (PermissionException e) {
throw new PermissionRestException(e);
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (KeyException e) {
throw new SchedulerRestException(e);
}
}
Aggregations