@Transactional(rollbackFor={GenieException.class,javax.validation.ConstraintViolationException.class})
public class JpaJobPersistenceServiceImpl
extends java.lang.Object
implements JobPersistenceService
| Constructor and Description | 
|---|
| JpaJobPersistenceServiceImpl(JpaJobRepository jobRepo,
                            JpaJobRequestRepository jobRequestRepo,
                            JpaJobMetadataRepository jobMetadataRepository,
                            JpaJobExecutionRepository jobExecutionRepo,
                            JpaApplicationRepository applicationRepo,
                            JpaClusterRepository clusterRepo,
                            JpaCommandRepository commandRepo)Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | createJob(JobRequest jobRequest,
         JobMetadata jobMetadata,
         Job job,
         JobExecution jobExecution)Save all the initial job fields in the data store. | 
| long | deleteAllJobsCreatedBeforeDate(java.util.Date date)This method will delete all jobs whose created time is less than date. | 
| void | setJobCompletionInformation(java.lang.String id,
                           int exitCode,
                           JobStatus status,
                           java.lang.String statusMessage,
                           java.lang.Long stdOutSize,
                           java.lang.Long stdErrSize)Method to set all job completion information for a job execution. | 
| void | setJobRunningInformation(java.lang.String id,
                        int processId,
                        long checkDelay,
                        java.util.Date timeout)Update the job with information for the running job process. | 
| void | updateJobStatus(java.lang.String id,
               JobStatus jobStatus,
               java.lang.String statusMsg)Update the status and status message of the job. | 
| void | updateJobWithRuntimeEnvironment(java.lang.String jobId,
                               java.lang.String clusterId,
                               java.lang.String commandId,
                               java.util.List<java.lang.String> applicationIds,
                               int memory)Update the job with the various resources used to run the job including the cluster, command and applications. | 
public JpaJobPersistenceServiceImpl(@NotNull
                                    JpaJobRepository jobRepo,
                                    @NotNull
                                    JpaJobRequestRepository jobRequestRepo,
                                    @NotNull
                                    JpaJobMetadataRepository jobMetadataRepository,
                                    @NotNull
                                    JpaJobExecutionRepository jobExecutionRepo,
                                    @NotNull
                                    JpaApplicationRepository applicationRepo,
                                    @NotNull
                                    JpaClusterRepository clusterRepo,
                                    @NotNull
                                    JpaCommandRepository commandRepo)
jobRepo - The job repository to usejobRequestRepo - The job request repository to usejobMetadataRepository - The job metadata repository to usejobExecutionRepo - The job execution repository to useapplicationRepo - The application repository to useclusterRepo - The cluster repository to usecommandRepo - The command repository to usepublic void createJob(@NotNull
                      JobRequest jobRequest,
                      @NotNull
                      JobMetadata jobMetadata,
                      @NotNull
                      Job job,
                      @NotNull
                      JobExecution jobExecution)
               throws GenieException
createJob in interface JobPersistenceServicejobRequest - the Job request object to save. Not nulljobMetadata - metadata about the job request. Not nulljob - The Job object to createjobExecution - The job execution object to createGenieException - if there is an errorpublic void updateJobStatus(@NotBlank(message="No job id entered. Unable to update.")
                            java.lang.String id,
                            @NotNull(message="Status cannot be null.")
                            JobStatus jobStatus,
                            @NotBlank(message="Status message cannot be empty.")
                            java.lang.String statusMsg)
                     throws GenieException
updateJobStatus in interface JobPersistenceServiceid - The id of the job to update the status for.jobStatus - The updated status of the job.statusMsg - The updated status message of the job.GenieException - if there is an errorpublic void updateJobWithRuntimeEnvironment(@NotBlank
                                            java.lang.String jobId,
                                            @NotBlank
                                            java.lang.String clusterId,
                                            @NotBlank
                                            java.lang.String commandId,
                                            @NotNull
                                            java.util.List<java.lang.String> applicationIds,
                                            @Min(value=1L)
                                            int memory)
                                     throws GenieException
updateJobWithRuntimeEnvironment in interface JobPersistenceServicejobId - The id of the job to updateclusterId - The id of the cluster the job runs oncommandId - The id of the command the job runs withapplicationIds - The ids of the applications used to run the jobmemory - The amount of memory (in MB) to run the job withGenieException - For any problems while updatingpublic void setJobRunningInformation(@NotBlank
                                     java.lang.String id,
                                     @Min(value=0L,message="Must be no lower than zero")
                                     int processId,
                                     @Min(value=1L,message="Must be at least 1 millisecond, preferably much more")
                                     long checkDelay,
                                     @NotNull
                                     java.util.Date timeout)
                              throws GenieException
setJobRunningInformation in interface JobPersistenceServiceid - the id of the job to update the process id forprocessId - The id of the process on the box for this jobcheckDelay - The delay to check the process withtimeout - The date at which this job should timeoutGenieException - if there is an errorpublic void setJobCompletionInformation(@NotBlank(message="No job id entered. Unable to update.")
                                        java.lang.String id,
                                        int exitCode,
                                        @NotNull(message="No job status entered. Unable to update")
                                        JobStatus status,
                                        @NotBlank(message="Status message can\'t be blank. Unable to update")
                                        java.lang.String statusMessage,
                                        @Nullable
                                        java.lang.Long stdOutSize,
                                        @Nullable
                                        java.lang.Long stdErrSize)
                                 throws GenieException
setJobCompletionInformation in interface JobPersistenceServiceid - the id of the job to update the exit codeexitCode - The exit code of the processstatus - The final job status for the jobstatusMessage - The final job status messagestdOutSize - The size (in bytes) of the standard out file or null if there isn't onestdErrSize - The size (in bytes) of the standard error file or null if there isn't oneGenieException - if there is an errorpublic long deleteAllJobsCreatedBeforeDate(@NotNull
                                           java.util.Date date)
deleteAllJobsCreatedBeforeDate in interface JobPersistenceServicedate - The date before which all jobs should be deleted