From c8fb89794255c9895133672de0b5aafd793e6e25 Mon Sep 17 00:00:00 2001 From: Zhou Zheng <1606079777@qq.comom> Date: Fri, 7 Aug 2020 16:35:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0dataAnalysis=E7=9A=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=BB=9F=E8=AE=A1=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. taskStateCount中添加了强制成功的状态 2. processStateCount中剔除强制成功的状态 --- .../dolphinscheduler/api/dto/TaskCountDto.java | 14 ++++++++++++++ .../api/service/DataAnalysisService.java | 3 +++ 2 files changed, 17 insertions(+) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskCountDto.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskCountDto.java index 6b0391f111..a17896580a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskCountDto.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskCountDto.java @@ -54,6 +54,7 @@ public class TaskCountDto { int needFaultTolerance = 0; int kill = 0; int waittingThread = 0; + int forcedSuccess = 0; for(ExecuteStatusCount taskInstanceStateCount : taskInstanceStateCounts){ ExecutionStatus status = taskInstanceStateCount.getExecutionStatus(); @@ -92,6 +93,9 @@ public class TaskCountDto { case WAITTING_THREAD: waittingThread += taskInstanceStateCount.getCount(); break; + case FORCED_SUCCESS: + forcedSuccess += taskInstanceStateCount.getCount(); + break; default: break; @@ -109,8 +113,18 @@ public class TaskCountDto { this.taskCountDtos.add(new TaskStateCount(ExecutionStatus.NEED_FAULT_TOLERANCE, needFaultTolerance)); this.taskCountDtos.add(new TaskStateCount(ExecutionStatus.KILL, kill)); this.taskCountDtos.add(new TaskStateCount(ExecutionStatus.WAITTING_THREAD, waittingThread)); + this.taskCountDtos.add(new TaskStateCount(ExecutionStatus.FORCED_SUCCESS, forcedSuccess)); } + // remove the specified state + public void removeStateFromCountList(ExecutionStatus status) { + for(TaskStateCount count : this.taskCountDtos) { + if (count.getTaskStateType().equals(status)) { + this.taskCountDtos.remove(count); + break; + } + } + } public List getTaskCountDtos(){ return taskCountDtos; diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java index 0375e9b699..691e7eec3f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java @@ -23,6 +23,7 @@ import org.apache.dolphinscheduler.api.dto.TaskCountDto; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; +import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; @@ -153,6 +154,8 @@ public class DataAnalysisService extends BaseService{ if (processInstanceStateCounts != null) { TaskCountDto taskCountResult = new TaskCountDto(processInstanceStateCounts); + // process state count needs to remove state of forced success + taskCountResult.removeStateFromCountList(ExecutionStatus.FORCED_SUCCESS); result.put(Constants.DATA_LIST, taskCountResult); putMsg(result, Status.SUCCESS); }