添加dataAnalysis的状态统计相关的部分

1. taskStateCount中添加了强制成功的状态
2. processStateCount中剔除强制成功的状态
This commit is contained in:
Zhou Zheng 2020-08-07 16:35:57 +08:00
parent 90a060128f
commit c8fb897942
2 changed files with 17 additions and 0 deletions

View File

@ -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<TaskStateCount> getTaskCountDtos(){
return taskCountDtos;

View File

@ -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);
}