Interface TaskExecutionDao
- All Known Implementing Classes:
JdbcTaskExecutionDao
,MapTaskExecutionDao
public interface TaskExecutionDao
Data Access Object for task executions.
- Author:
- Glenn Renfro, Gunnar Hillert, David Turanski
-
Method Summary
Modifier and TypeMethodDescriptionvoid
completeTaskExecution
(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage) Update and existingTaskExecution
.void
completeTaskExecution
(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage, String errorMessage) Update and existingTaskExecution
to mark it as completed.createTaskExecution
(String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId) Save a newTaskExecution
.createTaskExecution
(String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId) Save a newTaskExecution
.org.springframework.data.domain.Page<TaskExecution>
findAll
(org.springframework.data.domain.Pageable pageable) Retrieves all the task executions within the pageable constraints.org.springframework.data.domain.Page<TaskExecution>
findRunningTaskExecutions
(String taskName, org.springframework.data.domain.Pageable pageable) Retrieves a set of task executions that are running for a taskName.org.springframework.data.domain.Page<TaskExecution>
findTaskExecutionsByName
(String taskName, org.springframework.data.domain.Pageable pageable) Retrieves a subset of task executions by task name, start location and size.getJobExecutionIdsByTaskExecutionId
(long taskExecutionId) Returns the job execution ids associated with a task execution id.getLatestTaskExecutionForTaskName
(String taskName) Returns the latest task execution for a given task name.getLatestTaskExecutionsByTaskNames
(String... taskNames) Returns aList
of the latestTaskExecution
for 1 or more task names.long
Retrieves the next available execution id for a task execution.long
Retrieves current number of task executions with an endTime of null.long
getRunningTaskExecutionCountByTaskName
(String taskName) Retrieves current number of task executions for a taskName and with an endTime of null.getTaskExecution
(long executionId) Retrieves a task execution from the task repository.long
Retrieves current number of task executions.long
getTaskExecutionCountByTaskName
(String taskName) Retrieves current number of task executions for a taskName.getTaskExecutionIdByJobExecutionId
(long jobExecutionId) Returns the id of the TaskExecution that the requested Spring Batch job execution was executed within the context of.Retrieves a sorted list of distinct task names for the task executions.startTaskExecution
(long executionId, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId) Update and existingTaskExecution
to mark it as started.startTaskExecution
(long executionId, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId) Update and existingTaskExecution
to mark it as started.void
updateExternalExecutionId
(long taskExecutionId, String externalExecutionId) Updates the externalExecutionId for the execution id specified.
-
Method Details
-
createTaskExecution
TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId) Save a newTaskExecution
.- Parameters:
taskName
- the name that associated with the task execution.startTime
- the time task began.arguments
- list of key/value pairs that configure the task.externalExecutionId
- id assigned to the task by the platform- Returns:
- A fully qualified
TaskExecution
instance.
-
createTaskExecution
TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId) Save a newTaskExecution
.- Parameters:
taskName
- the name that associated with the task execution.startTime
- the time task began.arguments
- list of key/value pairs that configure the task.externalExecutionId
- id assigned to the task by the platformparentExecutionId
- the parent task execution id.- Returns:
- A fully qualified
TaskExecution
instance. - Since:
- 1.2.0
-
startTaskExecution
TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId) Update and existingTaskExecution
to mark it as started.- Parameters:
executionId
- the id of the taskExecution to be updated.taskName
- the name that associated with the task execution.startTime
- the time task began.arguments
- list of key/value pairs that configure the task.externalExecutionId
- id assigned to the task by the platform- Returns:
- A TaskExecution containing the information available at task execution start.
- Since:
- 1.1.0
-
startTaskExecution
TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId) Update and existingTaskExecution
to mark it as started.- Parameters:
executionId
- the id of the taskExecution to be updated.taskName
- the name that associated with the task execution.startTime
- the time task began.arguments
- list of key/value pairs that configure the task.externalExecutionId
- id assigned to the task by the platformparentExecutionId
- the parent task execution id.- Returns:
- A TaskExecution containing the information available at task execution start.
- Since:
- 1.2.0
-
completeTaskExecution
void completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage, String errorMessage) Update and existingTaskExecution
to mark it as completed.- Parameters:
executionId
- the id of the taskExecution to be updated.exitCode
- the status of the task upon completion.endTime
- the time the task completed.exitMessage
- the message assigned to the task upon completion.errorMessage
- error information available upon failure of a task.- Since:
- 1.1.0
-
completeTaskExecution
void completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage) Update and existingTaskExecution
.- Parameters:
executionId
- the id of the taskExecution to be updated.exitCode
- the status of the task upon completion.endTime
- the time the task completed.exitMessage
- the message assigned to the task upon completion.
-
getTaskExecution
Retrieves a task execution from the task repository.- Parameters:
executionId
- the id associated with the task execution.- Returns:
- a fully qualified TaskExecution instance.
-
getTaskExecutionCountByTaskName
Retrieves current number of task executions for a taskName.- Parameters:
taskName
- the name of the task to search for in the repository.- Returns:
- current number of task executions for the taskName.
-
getRunningTaskExecutionCountByTaskName
Retrieves current number of task executions for a taskName and with an endTime of null.- Parameters:
taskName
- the name of the task to search for in the repository.- Returns:
- current number of task executions for the taskName.
-
getRunningTaskExecutionCount
long getRunningTaskExecutionCount()Retrieves current number of task executions with an endTime of null.- Returns:
- current number of task executions.
-
getTaskExecutionCount
long getTaskExecutionCount()Retrieves current number of task executions.- Returns:
- current number of task executions.
-
findRunningTaskExecutions
org.springframework.data.domain.Page<TaskExecution> findRunningTaskExecutions(String taskName, org.springframework.data.domain.Pageable pageable) Retrieves a set of task executions that are running for a taskName.- Parameters:
taskName
- the name of the task to search for in the repository.pageable
- the constraints for the search.- Returns:
- set of running task executions.
-
findTaskExecutionsByName
org.springframework.data.domain.Page<TaskExecution> findTaskExecutionsByName(String taskName, org.springframework.data.domain.Pageable pageable) Retrieves a subset of task executions by task name, start location and size.- Parameters:
taskName
- the name of the task to search for in the repository.pageable
- the constraints for the search.- Returns:
- a list that contains task executions from the query bound by the start position and count specified by the user.
-
getTaskNames
Retrieves a sorted list of distinct task names for the task executions.- Returns:
- a list of distinct task names from the task repository..
-
findAll
org.springframework.data.domain.Page<TaskExecution> findAll(org.springframework.data.domain.Pageable pageable) Retrieves all the task executions within the pageable constraints.- Parameters:
pageable
- the constraints for the search- Returns:
- page containing the results from the search
-
getNextExecutionId
long getNextExecutionId()Retrieves the next available execution id for a task execution.- Returns:
- long containing the executionId.
-
getTaskExecutionIdByJobExecutionId
Returns the id of the TaskExecution that the requested Spring Batch job execution was executed within the context of. Returns null if non were found.- Parameters:
jobExecutionId
- the id of the JobExecution- Returns:
- the id of the
TaskExecution
-
getJobExecutionIdsByTaskExecutionId
Returns the job execution ids associated with a task execution id.- Parameters:
taskExecutionId
- id of theTaskExecution
- Returns:
- a
Set
of the ids of the job executions executed within the task.
-
updateExternalExecutionId
Updates the externalExecutionId for the execution id specified.- Parameters:
taskExecutionId
- the execution id for the task to be updated.externalExecutionId
- the new externalExecutionId.
-
getLatestTaskExecutionsByTaskNames
Returns aList
of the latestTaskExecution
for 1 or more task names. Latest is defined by the most recent start time. ATaskExecution
does not have to be finished (The results may including pendingTaskExecution
s). It is theoretically possible that aTaskExecution
with the same name to have more than 1TaskExecution
for the exact same start time. In that case theTaskExecution
with the highest Task Execution ID is returned. This method will not consider end times in its calculations. Thus, when a task executionA
starts after task executionB
but finishes BEFORE task executionA
, then task executionB
is being returned.- Parameters:
taskNames
- At least 1 task name must be provided- Returns:
- List of TaskExecutions. May be empty but never null.
-
getLatestTaskExecutionForTaskName
Returns the latest task execution for a given task name. Will ultimately apply the same algorithm underneath asgetLatestTaskExecutionsByTaskNames(String...)
but will only return a single result.- Parameters:
taskName
- Must not be null or empty- Returns:
- The latest Task Execution or null
- See Also:
-