Class DefaultTaskJobService
java.lang.Object
org.springframework.cloud.dataflow.server.service.impl.DefaultTaskJobService
- All Implemented Interfaces:
TaskJobService
Repository that retrieves Tasks and JobExecutions/Instances and the associations
between them.
- Author:
- Glenn Renfro., Gunnar Hillert, Mark Fisher, Ilayaperumal Gopinathan, Corneil du Plessis
-
Constructor Summary
ConstructorDescriptionDefaultTaskJobService
(JobService jobService, DataflowTaskExplorer taskExplorer, TaskDefinitionRepository taskDefinitionRepository, TaskExecutionService taskExecutionService, LauncherRepository launcherRepository, TaskConfigurationProperties taskConfigurationProperties) -
Method Summary
Modifier and TypeMethodDescriptiongetJobExecution
(long id) Retrieves a JobExecution from the JobRepository and matches it with a task id.getJobExecutionIdsByTaskExecutionIds
(Collection<Long> taskExecutionIds) getJobInstance
(long id) Retrieves aJobInstance
from the JobRepository and matches it with the associatedJobExecution
s.org.springframework.data.domain.Page<TaskJobExecution>
listJobExecutions
(org.springframework.data.domain.Pageable pageable) Retrieves Pageable list ofJobExecution
s from the JobRepository and matches the data with a task id.org.springframework.data.domain.Page<TaskJobExecution>
listJobExecutionsForJob
(org.springframework.data.domain.Pageable pageable, String jobName, org.springframework.batch.core.BatchStatus status) Retrieves Pageable list ofJobExecution
from the JobRepository with a specific jobName, status and matches the data with a task id.org.springframework.data.domain.Page<TaskJobExecution>
listJobExecutionsForJobWithStepCount
(org.springframework.data.domain.Pageable pageable, String jobName) Retrieves Pageable list ofJobExecutionWithStepCount
from the JobRepository with a specific jobName and matches the data with a task id.org.springframework.data.domain.Page<TaskJobExecution>
listJobExecutionsForJobWithStepCount
(org.springframework.data.domain.Pageable pageable, Date fromDate, Date toDate) Retrieves Pageable list ofJobExecutionWithStepCount
from the JobRepository filtered by the date range.org.springframework.data.domain.Page<TaskJobExecution>
listJobExecutionsForJobWithStepCountFilteredByJobInstanceId
(org.springframework.data.domain.Pageable pageable, int jobInstanceId) Retrieves Pageable list ofJobExecutionWithStepCount
from the JobRepository filtered by the job instance id.org.springframework.data.domain.Page<TaskJobExecution>
listJobExecutionsForJobWithStepCountFilteredByTaskExecutionId
(org.springframework.data.domain.Pageable pageable, int taskExecutionId) Retrieves Pageable list ofJobExecutionWithStepCount
from the JobRepository filtered by the task execution id.org.springframework.data.domain.Page<TaskJobExecution>
listJobExecutionsWithStepCount
(org.springframework.data.domain.Pageable pageable) Retrieves Pageable list ofJobExecutionWithStepCount
s from the JobRepository and matches the data with a task id but excludes the step executions.org.springframework.data.domain.Page<JobInstanceExecutions>
listTaskJobInstancesForJobName
(org.springframework.data.domain.Pageable pageable, String jobName) Retrieves Pageable list ofJobInstanceExecutions
from the JobRepository with a specific jobName and matches the data with the associated JobExecutions.void
restartJobExecution
(long jobExecutionId) Restarts aJobExecution
if the respectiveJobExecution
is actually deemed restartable.void
restartJobExecution
(long jobExecutionId, Boolean useJsonJobParameters) Restarts aJobExecution
if the respectiveJobExecution
is actually deemed restartable.void
stopJobExecution
(long jobExecutionId) Requests aJobExecution
to stop.
-
Constructor Details
-
DefaultTaskJobService
public DefaultTaskJobService(JobService jobService, DataflowTaskExplorer taskExplorer, TaskDefinitionRepository taskDefinitionRepository, TaskExecutionService taskExecutionService, LauncherRepository launcherRepository, TaskConfigurationProperties taskConfigurationProperties)
-
-
Method Details
-
listJobExecutions
public org.springframework.data.domain.Page<TaskJobExecution> listJobExecutions(org.springframework.data.domain.Pageable pageable) throws org.springframework.batch.core.launch.NoSuchJobExecutionException Description copied from interface:TaskJobService
Retrieves Pageable list ofJobExecution
s from the JobRepository and matches the data with a task id.- Specified by:
listJobExecutions
in interfaceTaskJobService
- Parameters:
pageable
- enumerates the data to be returned.- Returns:
- List containing
TaskJobExecution
s. - Throws:
org.springframework.batch.core.launch.NoSuchJobExecutionException
- in the event that a job execution id specified is not present when looking up stepExecutions for the result.
-
listJobExecutionsWithStepCount
public org.springframework.data.domain.Page<TaskJobExecution> listJobExecutionsWithStepCount(org.springframework.data.domain.Pageable pageable) Description copied from interface:TaskJobService
Retrieves Pageable list ofJobExecutionWithStepCount
s from the JobRepository and matches the data with a task id but excludes the step executions.- Specified by:
listJobExecutionsWithStepCount
in interfaceTaskJobService
- Parameters:
pageable
- enumerates the data to be returned.- Returns:
- List containing
TaskJobExecution
s.
-
listJobExecutionsForJob
public org.springframework.data.domain.Page<TaskJobExecution> listJobExecutionsForJob(org.springframework.data.domain.Pageable pageable, String jobName, org.springframework.batch.core.BatchStatus status) throws org.springframework.batch.core.launch.NoSuchJobException, org.springframework.batch.core.launch.NoSuchJobExecutionException Description copied from interface:TaskJobService
Retrieves Pageable list ofJobExecution
from the JobRepository with a specific jobName, status and matches the data with a task id.- Specified by:
listJobExecutionsForJob
in interfaceTaskJobService
- Parameters:
pageable
- enumerates the data to be returned.jobName
- the name of the job for which to findByTaskNameContains.status
- the BatchStatus of the job execution.- Returns:
- List containing
TaskJobExecution
s. - Throws:
org.springframework.batch.core.launch.NoSuchJobException
- if the job with the given name does not exist.org.springframework.batch.core.launch.NoSuchJobExecutionException
- the job execution with the given name doesn't exist.
-
listJobExecutionsForJobWithStepCount
public org.springframework.data.domain.Page<TaskJobExecution> listJobExecutionsForJobWithStepCount(org.springframework.data.domain.Pageable pageable, Date fromDate, Date toDate) Description copied from interface:TaskJobService
Retrieves Pageable list ofJobExecutionWithStepCount
from the JobRepository filtered by the date range.- Specified by:
listJobExecutionsForJobWithStepCount
in interfaceTaskJobService
- Parameters:
pageable
- enumerates the data to be returned.fromDate
- the date which start date must be greater than.toDate
- the date which start date must be less than.- Returns:
- List containing
JobExecutionWithStepCount
s.
-
listJobExecutionsForJobWithStepCountFilteredByJobInstanceId
public org.springframework.data.domain.Page<TaskJobExecution> listJobExecutionsForJobWithStepCountFilteredByJobInstanceId(org.springframework.data.domain.Pageable pageable, int jobInstanceId) Description copied from interface:TaskJobService
Retrieves Pageable list ofJobExecutionWithStepCount
from the JobRepository filtered by the job instance id.- Specified by:
listJobExecutionsForJobWithStepCountFilteredByJobInstanceId
in interfaceTaskJobService
- Parameters:
pageable
- enumerates the data to be returned.jobInstanceId
- the job instance id associated with the execution.- Returns:
- List containing
JobExecutionWithStepCount
s.
-
listJobExecutionsForJobWithStepCountFilteredByTaskExecutionId
public org.springframework.data.domain.Page<TaskJobExecution> listJobExecutionsForJobWithStepCountFilteredByTaskExecutionId(org.springframework.data.domain.Pageable pageable, int taskExecutionId) Description copied from interface:TaskJobService
Retrieves Pageable list ofJobExecutionWithStepCount
from the JobRepository filtered by the task execution id.- Specified by:
listJobExecutionsForJobWithStepCountFilteredByTaskExecutionId
in interfaceTaskJobService
- Parameters:
pageable
- enumerates the data to be returned.taskExecutionId
- the task execution id associated with the execution.- Returns:
- List containing
JobExecutionWithStepCount
s.
-
listJobExecutionsForJobWithStepCount
public org.springframework.data.domain.Page<TaskJobExecution> listJobExecutionsForJobWithStepCount(org.springframework.data.domain.Pageable pageable, String jobName) throws org.springframework.batch.core.launch.NoSuchJobException Description copied from interface:TaskJobService
Retrieves Pageable list ofJobExecutionWithStepCount
from the JobRepository with a specific jobName and matches the data with a task id.- Specified by:
listJobExecutionsForJobWithStepCount
in interfaceTaskJobService
- Parameters:
pageable
- enumerates the data to be returned.jobName
- the name of the job for which to findByTaskNameContains.- Returns:
- List containing
JobExecutionWithStepCount
s. - Throws:
org.springframework.batch.core.launch.NoSuchJobException
- if the job with the given name does not exist.
-
getJobExecution
public TaskJobExecution getJobExecution(long id) throws org.springframework.batch.core.launch.NoSuchJobExecutionException Description copied from interface:TaskJobService
Retrieves a JobExecution from the JobRepository and matches it with a task id.- Specified by:
getJobExecution
in interfaceTaskJobService
- Parameters:
id
- the id of theJobExecution
- Returns:
- the
TaskJobExecution
s associated with the id. - Throws:
org.springframework.batch.core.launch.NoSuchJobExecutionException
- if the specified job execution for the id does not exist.
-
listTaskJobInstancesForJobName
public org.springframework.data.domain.Page<JobInstanceExecutions> listTaskJobInstancesForJobName(org.springframework.data.domain.Pageable pageable, String jobName) throws org.springframework.batch.core.launch.NoSuchJobException Description copied from interface:TaskJobService
Retrieves Pageable list ofJobInstanceExecutions
from the JobRepository with a specific jobName and matches the data with the associated JobExecutions.- Specified by:
listTaskJobInstancesForJobName
in interfaceTaskJobService
- Parameters:
pageable
- enumerates the data to be returned.jobName
- the name of the job for which to findByTaskNameContains.- Returns:
- List containing
JobInstanceExecutions
. - Throws:
org.springframework.batch.core.launch.NoSuchJobException
- if the job for the jobName specified does not exist.
-
getJobInstance
public JobInstanceExecutions getJobInstance(long id) throws org.springframework.batch.core.launch.NoSuchJobInstanceException, org.springframework.batch.core.launch.NoSuchJobException Description copied from interface:TaskJobService
Retrieves aJobInstance
from the JobRepository and matches it with the associatedJobExecution
s.- Specified by:
getJobInstance
in interfaceTaskJobService
- Parameters:
id
- the id of theJobInstance
- Returns:
- the
JobInstanceExecutions
associated with the id. - Throws:
org.springframework.batch.core.launch.NoSuchJobInstanceException
- if job instance id does not exist.org.springframework.batch.core.launch.NoSuchJobException
- if the job for the job instance does not exist.
-
getJobExecutionIdsByTaskExecutionIds
- Specified by:
getJobExecutionIdsByTaskExecutionIds
in interfaceTaskJobService
-
restartJobExecution
public void restartJobExecution(long jobExecutionId) throws org.springframework.batch.core.launch.NoSuchJobExecutionException Description copied from interface:TaskJobService
Restarts aJobExecution
if the respectiveJobExecution
is actually deemed restartable. Otherwise aJobNotRestartableException
is being thrown. The system will useTaskConfigurationProperties.isUseJsonJobParameters()
to determine theJobParameter
serializer.- Specified by:
restartJobExecution
in interfaceTaskJobService
- Parameters:
jobExecutionId
- The id of the JobExecution to restart.- Throws:
org.springframework.batch.core.launch.NoSuchJobExecutionException
- if the JobExecution for the provided id does not exist.
-
restartJobExecution
public void restartJobExecution(long jobExecutionId, Boolean useJsonJobParameters) throws org.springframework.batch.core.launch.NoSuchJobExecutionException Description copied from interface:TaskJobService
Restarts aJobExecution
if the respectiveJobExecution
is actually deemed restartable. Otherwise, aJobNotRestartableException
is being thrown.- Specified by:
restartJobExecution
in interfaceTaskJobService
- Parameters:
jobExecutionId
- The id of the JobExecution to restart.useJsonJobParameters
- if set to true, dataflow will serialize job parameters to the command line using the format provided byJsonJobParametersConverter
. If set to false dataflow will useDefaultParametersConverter
. If null dataflow will useTaskConfigurationProperties.isUseJsonJobParameters()
to determine theJobParameter
serializer.- Throws:
org.springframework.batch.core.launch.NoSuchJobExecutionException
- if the JobExecution for the provided id does not exist.
-
stopJobExecution
public void stopJobExecution(long jobExecutionId) throws org.springframework.batch.core.launch.NoSuchJobExecutionException, org.springframework.batch.core.launch.JobExecutionNotRunningException Description copied from interface:TaskJobService
Requests aJobExecution
to stop.Please remember, that calling this method only requests a job execution to stop processing. This method does not guarantee a
JobExecution
to stop. It is the responsibility of the implementor of theJob
to react to that request. Furthermore, this method does not interfere with the associatedTaskExecution
.- Specified by:
stopJobExecution
in interfaceTaskJobService
- Parameters:
jobExecutionId
- The id of theJobExecution
to stop.- Throws:
org.springframework.batch.core.launch.NoSuchJobExecutionException
- thrown if no job execution exists for the jobExecutionId.org.springframework.batch.core.launch.JobExecutionNotRunningException
- thrown if a stop is requested on a job that is not running.- See Also:
-