Class DefaultDataFlowTaskExecutionQueryDao
java.lang.Object
org.springframework.cloud.dataflow.server.task.impl.DefaultDataFlowTaskExecutionQueryDao
- All Implemented Interfaces:
DataflowTaskExecutionQueryDao
public class DefaultDataFlowTaskExecutionQueryDao
extends Object
implements DataflowTaskExecutionQueryDao
Implementation of the
DataflowTaskExecutionQueryDao
.- Author:
- Corneil du Plessis
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultDataFlowTaskExecutionQueryDao
(DataSource dataSource) Initializes the DefaultDataFlowJobExecutionDao. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.data.domain.Page<org.springframework.cloud.task.repository.TaskExecution>
findAll
(org.springframework.data.domain.Pageable pageable) Retrieves all the task executions within the pageable constraints.List<org.springframework.cloud.task.repository.TaskExecution>
findChildTaskExecutions
(long executionId) Retrieves a list of task executions where the provided execution id and schemaTarget represents the parent of task execution.List<org.springframework.cloud.task.repository.TaskExecution>
findChildTaskExecutions
(Collection<Long> parentIds) Retrieves a list of task executions where the provided execution ids and schemaTarget represents the parents of task executions.List<org.springframework.cloud.task.repository.TaskExecution>
findTaskExecutions
(String taskName, boolean completed) Find task executions by task name and completion status.List<org.springframework.cloud.task.repository.TaskExecution>
findTaskExecutionsBeforeEndTime
(String taskName, Date endTime) Find task executions by task name whose end date is before the specified date.org.springframework.cloud.task.repository.TaskExecution
geTaskExecutionByExecutionId
(String externalExecutionId, String taskName) long
Retrieves current number of task executions for a taskName and with a non-null endTime.long
getCompletedTaskExecutionCountByTaskNameAndBeforeDate
(String taskName, Date endTime) Retrieves current number of task executions for a taskName and with a non-null endTime before the specified date.org.springframework.cloud.task.repository.TaskExecution
getLatestTaskExecutionForTaskName
(String taskName) Returns the latest task execution for a given task name.List<org.springframework.cloud.task.repository.TaskExecution>
getLatestTaskExecutionsByTaskNames
(String... taskNames) Returns aList
of the latestTaskExecution
for 1 or more task names.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.org.springframework.cloud.task.repository.TaskExecution
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.void
populateCtrStatus
(Collection<ThinTaskExecution> thinTaskExecutions)
-
Field Details
-
SELECT_CLAUSE
SELECT clause for task execution.- See Also:
-
FROM_CLAUSE
FROM clause for task execution.- See Also:
-
-
Constructor Details
-
DefaultDataFlowTaskExecutionQueryDao
Initializes the DefaultDataFlowJobExecutionDao.- Parameters:
dataSource
- used by the dao to execute queries and update the tables.
-
-
Method Details
-
geTaskExecutionByExecutionId
public org.springframework.cloud.task.repository.TaskExecution geTaskExecutionByExecutionId(String externalExecutionId, String taskName) - Specified by:
geTaskExecutionByExecutionId
in interfaceDataflowTaskExecutionQueryDao
-
getTaskExecution
public org.springframework.cloud.task.repository.TaskExecution getTaskExecution(long executionId) Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves a task execution from the task repository.- Specified by:
getTaskExecution
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
executionId
- the id associated with the task execution.- Returns:
- a fully qualified TaskExecution instance.
-
findChildTaskExecutions
public List<org.springframework.cloud.task.repository.TaskExecution> findChildTaskExecutions(long executionId) Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves a list of task executions where the provided execution id and schemaTarget represents the parent of task execution.- Specified by:
findChildTaskExecutions
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
executionId
- parent task execution id- Returns:
- the task executions
-
findChildTaskExecutions
public List<org.springframework.cloud.task.repository.TaskExecution> findChildTaskExecutions(Collection<Long> parentIds) Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves a list of task executions where the provided execution ids and schemaTarget represents the parents of task executions.- Specified by:
findChildTaskExecutions
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
parentIds
- parent task execution ids- Returns:
- the task executions
-
findTaskExecutions
public List<org.springframework.cloud.task.repository.TaskExecution> findTaskExecutions(String taskName, boolean completed) Description copied from interface:DataflowTaskExecutionQueryDao
Find task executions by task name and completion status.- Specified by:
findTaskExecutions
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
taskName
- the name of the task to search for in the repository.completed
- whether to include only completed task executions.- Returns:
- list of task executions
-
findTaskExecutionsBeforeEndTime
public List<org.springframework.cloud.task.repository.TaskExecution> findTaskExecutionsBeforeEndTime(String taskName, @NonNull Date endTime) Description copied from interface:DataflowTaskExecutionQueryDao
Find task executions by task name whose end date is before the specified date.- Specified by:
findTaskExecutionsBeforeEndTime
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
taskName
- the name of the task to search for in the repository.endTime
- the time before the task ended.- Returns:
- list of task executions.
-
getTaskExecutionCountByTaskName
Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves current number of task executions for a taskName.- Specified by:
getTaskExecutionCountByTaskName
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
taskName
- the name of the task- Returns:
- current number of task executions for the taskName.
-
getCompletedTaskExecutionCountByTaskName
Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves current number of task executions for a taskName and with a non-null endTime.- Specified by:
getCompletedTaskExecutionCountByTaskName
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
taskName
- the name of the task- Returns:
- the number of completed task executions
-
getCompletedTaskExecutionCountByTaskNameAndBeforeDate
public long getCompletedTaskExecutionCountByTaskNameAndBeforeDate(String taskName, @NonNull Date endTime) Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves current number of task executions for a taskName and with a non-null endTime before the specified date.- Specified by:
getCompletedTaskExecutionCountByTaskNameAndBeforeDate
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
taskName
- the name of the taskendTime
- the time before task ended- Returns:
- the number of completed task executions
-
getRunningTaskExecutionCountByTaskName
Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves current number of task executions for a taskName and with an endTime of null.- Specified by:
getRunningTaskExecutionCountByTaskName
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
taskName
- the name of the task to search for in the repository.- Returns:
- the number of running task executions
-
getRunningTaskExecutionCount
public long getRunningTaskExecutionCount()Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves current number of task executions with an endTime of null.- Specified by:
getRunningTaskExecutionCount
in interfaceDataflowTaskExecutionQueryDao
- Returns:
- current number of task executions.
-
getLatestTaskExecutionsByTaskNames
public List<org.springframework.cloud.task.repository.TaskExecution> getLatestTaskExecutionsByTaskNames(String... taskNames) Description copied from interface:DataflowTaskExecutionQueryDao
Returns aList
of the latestTaskExecution
for 1 or more task names.Latest is defined by the most recent start time. A
TaskExecution
does not have to be finished (The results may including pendingTaskExecution
s).It is theoretically possible that a
TaskExecution
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 execution
A
starts after task executionB
but finishes BEFORE task executionA
, then task executionB
is being returned.- Specified by:
getLatestTaskExecutionsByTaskNames
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
taskNames
- At least 1 task name must be provided- Returns:
- List of TaskExecutions. May be empty but never null.
-
getLatestTaskExecutionForTaskName
public org.springframework.cloud.task.repository.TaskExecution getLatestTaskExecutionForTaskName(String taskName) Description copied from interface:DataflowTaskExecutionQueryDao
Returns the latest task execution for a given task name. Will ultimately apply the same algorithm underneath asDataflowTaskExecutionQueryDao.getLatestTaskExecutionsByTaskNames(String...)
but will only return a single result.- Specified by:
getLatestTaskExecutionForTaskName
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
taskName
- Must not be null or empty- Returns:
- The latest Task Execution or null
- See Also:
-
getTaskExecutionCount
public long getTaskExecutionCount()Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves current number of task executions.- Specified by:
getTaskExecutionCount
in interfaceDataflowTaskExecutionQueryDao
- Returns:
- current number of task executions.
-
findAll
public org.springframework.data.domain.Page<org.springframework.cloud.task.repository.TaskExecution> findAll(org.springframework.data.domain.Pageable pageable) Description copied from interface:DataflowTaskExecutionQueryDao
Retrieves all the task executions within the pageable constraints.- Specified by:
findAll
in interfaceDataflowTaskExecutionQueryDao
- Parameters:
pageable
- the constraints for the search- Returns:
- page containing the results from the search
-
populateCtrStatus
- Specified by:
populateCtrStatus
in interfaceDataflowTaskExecutionQueryDao
-