use of org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException in project scheduling by ow2-proactive.
the class SchedulerStateRest method schedulerChangeJobPriorityByValue.
/**
* changes the priority of a job
*
* @param sessionId
* a valid session id
* @param jobId
* the job id
* @param priorityValue
* a string representing the value of the priority
* @throws NumberFormatException
* @throws NotConnectedRestException
* @throws UnknownJobRestException
* @throws PermissionRestException
* @throws JobAlreadyFinishedRestException
*/
@Override
@PUT
@Path("jobs/{jobid}/priority/byvalue/{value}")
public void schedulerChangeJobPriorityByValue(@HeaderParam("sessionid") final String sessionId, @PathParam("jobid") final String jobId, @PathParam("value") String priorityValue) throws NumberFormatException, NotConnectedRestException, UnknownJobRestException, PermissionRestException, JobAlreadyFinishedRestException {
try {
Scheduler s = checkAccess(sessionId, "jobs/" + jobId + "/priority/byvalue" + priorityValue);
s.changeJobPriority(jobId, JobPriority.findPriority(Integer.parseInt(priorityValue)));
} catch (PermissionException e) {
throw new PermissionRestException(e);
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (JobAlreadyFinishedException e) {
throw new JobAlreadyFinishedRestException(e);
} catch (UnknownJobException e) {
throw new UnknownJobRestException(e);
}
}
use of org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException in project scheduling by ow2-proactive.
the class SchedulerStateRest method schedulerChangeJobPriorityByName.
/**
* changes the priority of a job
*
* @param sessionId
* a valid session id
* @param jobId
* the job id
* @param priorityName
* a string representing the name of the priority
* @throws NotConnectedRestException
* @throws UnknownJobRestException
* @throws PermissionRestException
* @throws JobAlreadyFinishedRestException
*/
@Override
@PUT
@Path("jobs/{jobid}/priority/byname/{name}")
public void schedulerChangeJobPriorityByName(@HeaderParam("sessionid") final String sessionId, @PathParam("jobid") final String jobId, @PathParam("name") String priorityName) throws NotConnectedRestException, UnknownJobRestException, PermissionRestException, JobAlreadyFinishedRestException {
try {
Scheduler s = checkAccess(sessionId, "jobs/" + jobId + "/priority/byname/" + priorityName);
s.changeJobPriority(jobId, JobPriority.findPriority(priorityName));
} catch (PermissionException e) {
throw new PermissionRestException(e);
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (JobAlreadyFinishedException e) {
throw new JobAlreadyFinishedRestException(e);
} catch (UnknownJobException e) {
throw new UnknownJobRestException(e);
}
}
use of org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException in project scheduling by ow2-proactive.
the class SchedulerFrontendState method checkChangeJobPriority.
synchronized void checkChangeJobPriority(JobId jobId, JobPriority priority) throws NotConnectedException, UnknownJobException, PermissionException, JobAlreadyFinishedException {
checkPermissions("changeJobPriority", getIdentifiedJob(jobId), YOU_DO_NOT_HAVE_PERMISSION_TO_CHANGE_THE_PRIORITY_OF_THIS_JOB);
UserIdentificationImpl ui = identifications.get(PAActiveObject.getContext().getCurrentRequest().getSourceBodyID()).getUser();
try {
ui.checkPermission(new ChangePriorityPermission(priority.getPriority()), ui.getUsername() + " does not have permissions to set job priority to " + priority);
} catch (PermissionException ex) {
logger.info(ex.getMessage());
throw ex;
}
if (jobs.get(jobId).isFinished()) {
String msg = " is already finished";
jlogger.info(jobId, msg);
throw new JobAlreadyFinishedException("Job " + jobId + msg);
}
}
Aggregations