Search in sources :

Example 51 with NotConnectedException

use of org.ow2.proactive.resourcemanager.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);
}
Also used : JobId(org.ow2.proactive.scheduler.common.job.JobId)

Example 52 with NotConnectedException

use of org.ow2.proactive.resourcemanager.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);
}
Also used : UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) JobId(org.ow2.proactive.scheduler.common.job.JobId) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 53 with NotConnectedException

use of org.ow2.proactive.resourcemanager.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);
}
Also used : UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 54 with NotConnectedException

use of org.ow2.proactive.resourcemanager.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;
    }
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl) KeyException(java.security.KeyException) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) TaskCouldNotRestartException(org.ow2.proactive.scheduler.common.exception.TaskCouldNotRestartException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) AlreadyConnectedException(org.ow2.proactive.scheduler.common.exception.AlreadyConnectedException) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) TaskCouldNotStartException(org.ow2.proactive.scheduler.common.exception.TaskCouldNotStartException) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) DatabaseManagerException(org.ow2.proactive.db.DatabaseManagerException) TaskSkippedException(org.ow2.proactive.scheduler.common.exception.TaskSkippedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 55 with NotConnectedException

use of org.ow2.proactive.resourcemanager.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);
}
Also used : UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Aggregations

NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)68 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)64 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)51 PermissionRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException)48 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)46 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)40 Path (javax.ws.rs.Path)39 Produces (javax.ws.rs.Produces)37 UnknownJobRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException)36 GET (javax.ws.rs.GET)28 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)27 JobState (org.ow2.proactive.scheduler.common.job.JobState)21 JobAlreadyFinishedException (org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)19 GZIP (org.jboss.resteasy.annotations.GZIP)18 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)18 IOException (java.io.IOException)17 ArrayList (java.util.ArrayList)17 SubmissionClosedException (org.ow2.proactive.scheduler.common.exception.SubmissionClosedException)17 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)16 TaskState (org.ow2.proactive.scheduler.common.task.TaskState)16