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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultDataFlowTaskExecutionQueryDao(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.TaskExecutiongeTaskExecutionByExecutionId(String externalExecutionId, String taskName) longRetrieves current number of task executions for a taskName and with a non-null endTime.longgetCompletedTaskExecutionCountByTaskNameAndBeforeDate(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.TaskExecutiongetLatestTaskExecutionForTaskName(String taskName) Returns the latest task execution for a given task name.List<org.springframework.cloud.task.repository.TaskExecution>getLatestTaskExecutionsByTaskNames(String... taskNames) Returns aListof the latestTaskExecutionfor 1 or more task names.longRetrieves current number of task executions with an endTime of null.longgetRunningTaskExecutionCountByTaskName(String taskName) Retrieves current number of task executions for a taskName and with an endTime of null.org.springframework.cloud.task.repository.TaskExecutiongetTaskExecution(long executionId) Retrieves a task execution from the task repository.longRetrieves current number of task executions.longgetTaskExecutionCountByTaskName(String taskName) Retrieves current number of task executions for a taskName.voidpopulateCtrStatus(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:
geTaskExecutionByExecutionIdin interfaceDataflowTaskExecutionQueryDao
-
getTaskExecution
public org.springframework.cloud.task.repository.TaskExecution getTaskExecution(long executionId) Description copied from interface:DataflowTaskExecutionQueryDaoRetrieves a task execution from the task repository.- Specified by:
getTaskExecutionin 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:DataflowTaskExecutionQueryDaoRetrieves a list of task executions where the provided execution id and schemaTarget represents the parent of task execution.- Specified by:
findChildTaskExecutionsin 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:DataflowTaskExecutionQueryDaoRetrieves a list of task executions where the provided execution ids and schemaTarget represents the parents of task executions.- Specified by:
findChildTaskExecutionsin 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:DataflowTaskExecutionQueryDaoFind task executions by task name and completion status.- Specified by:
findTaskExecutionsin 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:DataflowTaskExecutionQueryDaoFind task executions by task name whose end date is before the specified date.- Specified by:
findTaskExecutionsBeforeEndTimein 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:DataflowTaskExecutionQueryDaoRetrieves current number of task executions for a taskName.- Specified by:
getTaskExecutionCountByTaskNamein interfaceDataflowTaskExecutionQueryDao- Parameters:
taskName- the name of the task- Returns:
- current number of task executions for the taskName.
-
getCompletedTaskExecutionCountByTaskName
Description copied from interface:DataflowTaskExecutionQueryDaoRetrieves current number of task executions for a taskName and with a non-null endTime.- Specified by:
getCompletedTaskExecutionCountByTaskNamein 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:DataflowTaskExecutionQueryDaoRetrieves current number of task executions for a taskName and with a non-null endTime before the specified date.- Specified by:
getCompletedTaskExecutionCountByTaskNameAndBeforeDatein 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:DataflowTaskExecutionQueryDaoRetrieves current number of task executions for a taskName and with an endTime of null.- Specified by:
getRunningTaskExecutionCountByTaskNamein 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:DataflowTaskExecutionQueryDaoRetrieves current number of task executions with an endTime of null.- Specified by:
getRunningTaskExecutionCountin interfaceDataflowTaskExecutionQueryDao- Returns:
- current number of task executions.
-
getLatestTaskExecutionsByTaskNames
public List<org.springframework.cloud.task.repository.TaskExecution> getLatestTaskExecutionsByTaskNames(String... taskNames) Description copied from interface:DataflowTaskExecutionQueryDaoReturns aListof the latestTaskExecutionfor 1 or more task names.Latest is defined by the most recent start time. A
TaskExecutiondoes not have to be finished (The results may including pendingTaskExecutions).It is theoretically possible that a
TaskExecutionwith the same name to have more than 1TaskExecutionfor the exact same start time. In that case theTaskExecutionwith the highest Task Execution ID is returned.This method will not consider end times in its calculations. Thus, when a task execution
Astarts after task executionBbut finishes BEFORE task executionA, then task executionBis being returned.- Specified by:
getLatestTaskExecutionsByTaskNamesin 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:DataflowTaskExecutionQueryDaoReturns 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:
getLatestTaskExecutionForTaskNamein 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:DataflowTaskExecutionQueryDaoRetrieves current number of task executions.- Specified by:
getTaskExecutionCountin 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:DataflowTaskExecutionQueryDaoRetrieves all the task executions within the pageable constraints.- Specified by:
findAllin interfaceDataflowTaskExecutionQueryDao- Parameters:
pageable- the constraints for the search- Returns:
- page containing the results from the search
-
populateCtrStatus
- Specified by:
populateCtrStatusin interfaceDataflowTaskExecutionQueryDao
-