Interface JobExplorer
- All Known Implementing Classes:
SimpleJobExplorer
public interface JobExplorer
Entry point for browsing the executions of running or historical jobs and steps. Since
the data may be re-hydrated from persistent storage, it cannot contain volatile fields
that would have been present when the execution was active.
- Since:
- 2.0
- Author:
- Dave Syer, Michael Minella, Will Schipp, Mahmoud Ben Hassine, Parikshit Dutta
-
Method Summary
Modifier and TypeMethodDescriptionfindJobInstancesByJobName(String jobName, int start, int count) FetchJobInstancevalues in descending order of creation (and, therefore, usually of first execution) with a 'like' or wildcard criteria.findRunningJobExecutions(String jobName) Retrieve running job executions.getJobExecution(Long executionId) Retrieve aJobExecutionby its ID.getJobExecutions(JobInstance jobInstance) Retrieve job executions by their job instance.getJobInstance(Long instanceId) default JobInstancegetJobInstance(String jobName, JobParameters jobParameters) longgetJobInstanceCount(String jobName) Query the repository for the number of uniqueJobInstanceobjects associated with the supplied job name.getJobInstances(String jobName, int start, int count) FetchJobInstancevalues in descending order of creation (and, therefore, usually, of first execution).Query the repository for all uniqueJobInstancenames (sorted alphabetically).default JobExecutiongetLastJobExecution(JobInstance jobInstance) Find the lastJobExecutionthat has been created for a givenJobInstance.default JobInstancegetLastJobInstance(String jobName) Find the last job instance, by ID, for the given job.getStepExecution(Long jobExecutionId, Long stepExecutionId) Retrieve aStepExecutionby its ID and parentJobExecutionID.
-
Method Details
-
getJobInstances
FetchJobInstancevalues in descending order of creation (and, therefore, usually, of first execution).- Parameters:
jobName- The name of the job to query.start- The start index of the instances to return.count- The maximum number of instances to return.- Returns:
- the
JobInstancevalues up to a maximum of count values.
-
getLastJobInstance
Find the last job instance, by ID, for the given job.- Parameters:
jobName- The name of the job.- Returns:
- the last job instance by Id if any or
nullotherwise. - Since:
- 4.2
-
getJobExecution
Retrieve aJobExecutionby its ID. The complete object graph for this execution should be returned (unless otherwise indicated), including the parentJobInstanceand associatedExecutionContextandStepExecutioninstances (also including their execution contexts).- Parameters:
executionId- The job execution ID.- Returns:
- the
JobExecutionthat has this ID ornullif not found.
-
getStepExecution
@Nullable StepExecution getStepExecution(@Nullable Long jobExecutionId, @Nullable Long stepExecutionId) Retrieve aStepExecutionby its ID and parentJobExecutionID. The execution context for the step should be available in the result, and the parent job execution should have its primitive properties, but it may not contain the job instance information.- Parameters:
jobExecutionId- The parent job execution ID.stepExecutionId- The step execution ID.- Returns:
- the
StepExecutionthat has this ID ornullif not found. - See Also:
-
getJobInstance
- Parameters:
instanceId-LongThe ID for theJobInstanceto obtain.- Returns:
- the
JobInstancethat has this ID, ornullif not found.
-
getJobInstance
- Parameters:
jobName-Stringname of the job.jobParameters-JobParametersparameters for the job instance.- Returns:
- the
JobInstancewith the given name and parameters, ornull. - Since:
- 5.0
-
getJobExecutions
Retrieve job executions by their job instance. The corresponding step executions may not be fully hydrated (for example, their execution context may be missing), depending on the implementation. In that case, usegetStepExecution(Long, Long)to hydrate them.- Parameters:
jobInstance- TheJobInstanceto query.- Returns:
- the list of all executions for the specified
JobInstance.
-
getLastJobExecution
Find the lastJobExecutionthat has been created for a givenJobInstance.- Parameters:
jobInstance- TheJobInstancefor which to find the lastJobExecution.- Returns:
- the last
JobExecutionthat has been created for this instance ornullif no job execution is found for the given job instance. - Since:
- 4.2
-
findRunningJobExecutions
Retrieve running job executions. The corresponding step executions may not be fully hydrated (for example, their execution context may be missing), depending on the implementation. In that case, usegetStepExecution(Long, Long)to hydrate them.- Parameters:
jobName- The name of the job.- Returns:
- the set of running executions for jobs with the specified name.
-
getJobNames
Query the repository for all uniqueJobInstancenames (sorted alphabetically).- Returns:
- the list of job names that have been executed.
-
findJobInstancesByJobName
FetchJobInstancevalues in descending order of creation (and, therefore, usually of first execution) with a 'like' or wildcard criteria.- Parameters:
jobName- The name of the job for which to query.start- The start index of the instances to return.count- The maximum number of instances to return.- Returns:
- a list of
JobInstancefor the requested job name.
-
getJobInstanceCount
Query the repository for the number of uniqueJobInstanceobjects associated with the supplied job name.- Parameters:
jobName- The name of the job for which to query.- Returns:
- the number of
JobInstances that exist within the associated job repository. - Throws:
NoSuchJobException- thrown when there is noJobInstancefor the jobName specified.
-