use of org.molgenis.jobs.model.JobExecution in project molgenis by molgenis.
the class ProgressImplTest method beforeMethod.
@BeforeMethod
public void beforeMethod() {
jobExecution = new JobExecution(jobExecutionMeta) {
};
jobExecution.setIdentifier("ABCDE");
jobExecution.setType("Annotator");
progress = new ProgressImpl(jobExecution, updater, mailSender);
}
use of org.molgenis.jobs.model.JobExecution in project molgenis by molgenis.
the class JobExecutor method createJobExecution.
private JobExecution createJobExecution(ScheduledJob scheduledJob) {
JobExecution jobExecution = (JobExecution) entityManager.create(scheduledJob.getType().getJobExecutionType(), POPULATE);
writePropertyValues(jobExecution, getPropertyValues(scheduledJob.getParameters()));
jobExecution.setFailureEmail(scheduledJob.getFailureEmail());
jobExecution.setSuccessEmail(scheduledJob.getSuccessEmail());
jobExecution.setUser(scheduledJob.getUser());
jobExecution.setScheduledJobId(scheduledJob.getId());
return jobExecution;
}
use of org.molgenis.jobs.model.JobExecution in project molgenis by molgenis.
the class JobExecutor method executeScheduledJob.
/**
* Executes a {@link ScheduledJob} in the current thread.
*
* @param scheduledJobId ID of the {@link ScheduledJob} to run
*/
@RunAsSystem
public void executeScheduledJob(String scheduledJobId) {
ScheduledJob scheduledJob = dataService.findOneById(SCHEDULED_JOB, scheduledJobId, ScheduledJob.class);
JobExecution jobExecution = createJobExecution(scheduledJob);
Job molgenisJob = saveExecutionAndCreateJob(jobExecution);
try {
runJob(jobExecution, molgenisJob);
} catch (Exception ex) {
LOG.error("Error creating job for JobExecution.", ex);
jobExecution.setStatus(JobExecution.Status.FAILED);
jobExecution.setProgressMessage(ex.getMessage());
dataService.update(jobExecution.getEntityType().getId(), jobExecution);
throw ex;
}
}
Aggregations