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);
}
}
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;
}
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;
}
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);
}
Aggregations