use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontend method restartAllInErrorTasks.
@Override
public boolean restartAllInErrorTasks(String jobId) throws NotConnectedException, UnknownJobException, PermissionException {
final JobId jobIdObject = JobIdImpl.makeJobId(jobId);
frontendState.checkPermissions("restartAllInErrorTasks", frontendState.getIdentifiedJob(jobIdObject), YOU_DO_NOT_HAVE_PERMISSION_TO_RESTART_IN_ERROR_TASKS_IN_THIS_JOB);
return schedulingService.restartAllInErrorTasks(jobIdObject);
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontend method getTaskServerLogs.
@Override
@ImmediateService
public String getTaskServerLogs(String jobId, String taskName) throws UnknownJobException, UnknownTaskException, NotConnectedException, PermissionException {
JobId id = JobIdImpl.makeJobId(jobId);
frontendState.checkPermissions("getTaskServerLogs", frontendState.getIdentifiedJob(id), YOU_DO_NOT_HAVE_PERMISSION_TO_GET_THE_TASK_LOGS_OF_THIS_JOB);
for (TaskId taskId : frontendState.getJobTasks(id)) {
if (taskId.getReadableName().equals(taskName)) {
return ServerJobAndTaskLogs.getTaskLog(taskId);
}
}
throw new UnknownTaskException("Unknown task " + taskName + " in job " + jobId);
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontend method getJobs.
/**
* {@inheritDoc}
*/
@Override
@ImmediateService
public Page<JobInfo> getJobs(int offset, int limit, JobFilterCriteria filterCriteria, List<SortParameter<JobSortParameter>> sortParameters) throws NotConnectedException, PermissionException {
UserIdentificationImpl ident = frontendState.checkPermission("getJobs", "You don't have permissions to load jobs");
boolean myJobsOnly = filterCriteria.isMyJobsOnly();
String user;
if (myJobsOnly) {
user = ident.getUsername();
} else {
user = null;
}
return dbManager.getJobs(offset, limit, user, filterCriteria.isPending(), filterCriteria.isRunning(), filterCriteria.isFinished(), sortParameters);
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontend method submit.
/**
* {@inheritDoc}
*/
@Override
@ImmediateService
public JobId submit(Job userJob) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
try {
if (logger.isDebugEnabled()) {
logger.debug("New job submission requested : " + userJob.getName());
}
// check if the scheduler is stopped
if (!schedulingService.isSubmitPossible()) {
String msg = "Scheduler is stopped, cannot submit job";
logger.info(msg);
throw new SubmissionClosedException(msg);
}
UserIdentificationImpl ident = frontendState.checkPermission("submit", YOU_DO_NOT_HAVE_PERMISSION_TO_SUBMIT_A_JOB);
InternalJob job = frontendState.createJob(userJob, ident);
schedulingService.submitJob(job);
frontendState.jobSubmitted(job, ident);
return job.getId();
} catch (Exception e) {
logger.warn("Error when submitting job.", e);
throw e;
}
}
use of org.ow2.proactive.scheduler.common.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontend method removeThirdPartyCredential.
@Override
public void removeThirdPartyCredential(String key) throws NotConnectedException, PermissionException {
UserIdentificationImpl ident = frontendState.checkPermission("removeThirdPartyCredential", YOU_DO_NOT_HAVE_PERMISSION_TO_REMOVE_THIRD_PARTY_CREDENTIALS_FROM_THE_SCHEDULER);
dbManager.removeThirdPartyCredential(ident.getUsername(), key);
}
Aggregations