Search in sources :

Example 1 with YOU_DO_NOT_HAVE_PERMISSION_TO_KILL_THIS_JOB

use of org.ow2.proactive.scheduler.core.SchedulerFrontendState.YOU_DO_NOT_HAVE_PERMISSION_TO_KILL_THIS_JOB in project scheduling by ow2-proactive.

the class SchedulerFrontend method killJobs.

@Override
@ImmediateService
public boolean killJobs(List<String> jobIds) throws NotConnectedException, PermissionException {
    if (jobIds.isEmpty()) {
        return false;
    }
    String currentUser = frontendState.getCurrentUser();
    List<JobId> jobIdsConverted = jobIds.stream().map(JobIdImpl::makeJobId).collect(Collectors.toList());
    // checking permission for each of the job
    for (JobId jobId : jobIdsConverted) {
        try {
            frontendState.checkPermissions("killJob", frontendState.getIdentifiedJob(jobId), YOU_DO_NOT_HAVE_PERMISSION_TO_KILL_THIS_JOB);
        } catch (UnknownJobException e) {
            logger.debug(e);
        }
    }
    logger.info("Request to kill jobs " + jobIds + " received from " + currentUser);
    return schedulingService.killJobs(jobIdsConverted);
}
Also used : UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) JobId(org.ow2.proactive.scheduler.common.job.JobId) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Aggregations

ImmediateService (org.objectweb.proactive.annotation.ImmediateService)1 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1