@Transactional(rollbackFor={GenieException.class,javax.validation.ConstraintViolationException.class})
public class JpaJobPersistenceServiceImpl
extends java.lang.Object
implements JobPersistenceService
| Constructor and Description |
|---|
JpaJobPersistenceServiceImpl(TagService tagService,
JpaTagRepository tagRepository,
FileService fileService,
JpaFileRepository fileRepository,
JpaJobRepository jobRepository,
JpaApplicationRepository applicationRepository,
JpaClusterRepository clusterRepository,
JpaCommandRepository commandRepository)
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 |
deleteBatchOfJobsCreatedBeforeDate(java.util.Date date,
int maxDeleted,
int pageSize)
This method will delete a chunk of jobs whose creation time is earlier than the given 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(TagService tagService, JpaTagRepository tagRepository, FileService fileService, JpaFileRepository fileRepository, JpaJobRepository jobRepository, JpaApplicationRepository applicationRepository, JpaClusterRepository clusterRepository, JpaCommandRepository commandRepository)
tagService - The tag service to usetagRepository - The tag repository to usefileService - The file service to usefileRepository - The file repository to usejobRepository - The job repository to useapplicationRepository - The application repository to useclusterRepository - The cluster repository to usecommandRepository - 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 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 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 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 deleteBatchOfJobsCreatedBeforeDate(@NotNull
java.util.Date date,
@Min(value=1L)
int maxDeleted,
@Min(value=1L)
int pageSize)
deleteBatchOfJobsCreatedBeforeDate in interface JobPersistenceServicedate - The date before which all jobs should be deletedmaxDeleted - The maximum number of jobs that should be deleted
(soft limit, can be rounded up to multiple of page size)pageSize - Page size used to iterate through jobs