caishunfeng commented on a change in pull request #7768:
URL: https://github.com/apache/dolphinscheduler/pull/7768#discussion_r777171949
##########
File path:
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
##########
@@ -529,6 +529,39 @@ public void removeTaskLogFile(Integer processInstanceId) {
}
}
+ /**
+ * recursive delete all task instance by process instance id
+ * @param processInstanceId
+ */
+ public void deleteWorkTaskInstanceByProcessInstanceId(int
processInstanceId) {
+ List<TaskInstance> taskInstanceList =
findValidTaskListByProcessId(processInstanceId);
+ if (CollectionUtils.isEmpty(taskInstanceList)) {
+ return;
+ }
+
+ for (TaskInstance taskInstance : taskInstanceList) {
+ taskInstanceMapper.deleteById(taskInstance.getId());
+ removeTaskLogFile(taskInstance);
+ }
+ }
+
+ /**
+ * remove task log file by task instance
+ *
+ * @param taskInstance taskInstance
+ */
+ public void removeTaskLogFile(TaskInstance taskInstance) {
+ try (LogClientService logClient = new LogClientService()) {
Review comment:
It seems that it can be operated by batch and don't have to create
logClient and release every time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]