Search in sources :

Example 1 with IdentifiedJob

use of org.ow2.proactive.scheduler.job.IdentifiedJob 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);
    }
}
Also used : IdentifiedJob(org.ow2.proactive.scheduler.job.IdentifiedJob) UserIdentification(org.ow2.proactive.scheduler.common.job.UserIdentification) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) 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) IOException(java.io.IOException) SchedulerException(org.ow2.proactive.scheduler.common.exception.SchedulerException)

Example 2 with IdentifiedJob

use of org.ow2.proactive.scheduler.job.IdentifiedJob in project scheduling by ow2-proactive.

the class SchedulerFrontendState method getIdentifiedJob.

synchronized IdentifiedJob getIdentifiedJob(JobId jobId) throws UnknownJobException {
    IdentifiedJob ij = jobs.get(jobId);
    if (ij == null) {
        String msg = "The job represented by this ID '" + jobId + "' is unknown !";
        logger.info(msg);
        throw new UnknownJobException(msg);
    }
    return ij;
}
Also used : UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) IdentifiedJob(org.ow2.proactive.scheduler.job.IdentifiedJob)

Example 3 with IdentifiedJob

use of org.ow2.proactive.scheduler.job.IdentifiedJob in project scheduling by ow2-proactive.

the class SchedulerFrontend method getJobResult.

/**
 * {@inheritDoc}
 */
@Override
@ImmediateService
public JobResult getJobResult(final JobId jobId) throws NotConnectedException, PermissionException, UnknownJobException {
    // checking permissions
    IdentifiedJob ij = frontendState.getIdentifiedJob(jobId);
    frontendState.checkPermissions("getJobResult", ij, YOU_DO_NOT_HAVE_PERMISSION_TO_GET_THE_RESULT_OF_THIS_JOB);
    if (!ij.isFinished()) {
        jlogger.info(jobId, "is not finished");
        jlogger.info(jobId, "Job state: " + frontendState.getJobState(jobId).getStatus());
        return null;
    }
    jlogger.info(jobId, "trying to get the job result");
    JobResult result = dbManager.loadJobResult(jobId);
    if (result == null) {
        throw new UnknownJobException(jobId);
    }
    if (!result.getJobInfo().isToBeRemoved() && SCHEDULER_REMOVED_JOB_DELAY > 0) {
        // remember that this job is to be removed
        dbManager.jobSetToBeRemoved(jobId);
        schedulingService.scheduleJobRemove(jobId, System.currentTimeMillis() + SCHEDULER_REMOVED_JOB_DELAY);
        jlogger.info(jobId, "will be removed in " + (SCHEDULER_REMOVED_JOB_DELAY / 1000) + "sec");
    }
    return result;
}
Also used : JobResult(org.ow2.proactive.scheduler.common.job.JobResult) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) IdentifiedJob(org.ow2.proactive.scheduler.job.IdentifiedJob) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 4 with IdentifiedJob

use of org.ow2.proactive.scheduler.job.IdentifiedJob in project scheduling by ow2-proactive.

the class SchedulerFrontendState method prepare.

/**
 * Prepare the job in the frontend
 *
 * @param jobStates
 *            a temporary set of jobs
 * @param js
 *            the current job to be prepared
 * @param finished
 *            if the job is finished or not
 */
private void prepare(Set<JobState> jobStates, ClientJobState js, boolean finished) {
    jobStates.add(js);
    UserIdentificationImpl uIdent = new UserIdentificationImpl(js.getOwner());
    IdentifiedJob ij = new IdentifiedJob(js.getId(), uIdent, js.getGenericInformation());
    jobs.put(js.getId(), ij);
    jobsMap.put(js.getId(), js);
    ij.setFinished(finished);
}
Also used : IdentifiedJob(org.ow2.proactive.scheduler.job.IdentifiedJob) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Aggregations

IdentifiedJob (org.ow2.proactive.scheduler.job.IdentifiedJob)4 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)3 IOException (java.io.IOException)1 ImmediateService (org.objectweb.proactive.annotation.ImmediateService)1 AlreadyConnectedException (org.ow2.proactive.scheduler.common.exception.AlreadyConnectedException)1 JobAlreadyFinishedException (org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)1 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)1 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)1 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)1 SchedulerException (org.ow2.proactive.scheduler.common.exception.SchedulerException)1 SubmissionClosedException (org.ow2.proactive.scheduler.common.exception.SubmissionClosedException)1 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)1 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)1 UserIdentification (org.ow2.proactive.scheduler.common.job.UserIdentification)1 UserIdentificationImpl (org.ow2.proactive.scheduler.job.UserIdentificationImpl)1