From f5a5ea057718215ec2c9c10f23dd16345e05f7a9 Mon Sep 17 00:00:00 2001 From: qiaozhanwei Date: Thu, 10 Oct 2019 17:56:40 +0800 Subject: [PATCH] countCommandState sql update (#981) * add ConnectionFactoryTest and ConnectionFactory read datasource from appliction.yml * .escheduler_env.sh to dolphinscheduler_env.sh * dao yml assembly to conf directory * table name modify * entity title table name modify * logback log name modify * running through the big process * running through the big process error modify * logback log name modify * data_source.properties rename * logback log name modify * install.sh optimization * install.sh optimization * command count modify * command state update * countCommandState sql update * countCommandState sql update --- .../api/service/DataAnalysisService.java | 45 +++++++++++-------- .../dao/mapper/CommandMapper.xml | 2 +- .../dao/mapper/ErrorCommandMapper.xml | 2 +- 3 files changed, 28 insertions(+), 21 deletions(-) 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 6e8e82ddb..a64e01e35 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.api.utils.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.queue.ITaskQueue; import org.apache.dolphinscheduler.common.queue.TaskQueueFactory; @@ -246,15 +247,18 @@ public class DataAnalysisService { Date start = null; Date end = null; - try { - start = DateUtils.getScheduleDate(startDate); - end = DateUtils.getScheduleDate(endDate); - } catch (Exception e) { - logger.error(e.getMessage(),e); - putErrorRequestParamsMsg(result); - return result; + if (startDate != null && endDate != null){ + try { + start = DateUtils.getScheduleDate(startDate); + end = DateUtils.getScheduleDate(endDate); + } catch (Exception e) { + logger.error(e.getMessage(),e); + putErrorRequestParamsMsg(result); + return result; + } } + Integer[] projectIdArray = getProjectIdsArrays(loginUser, projectId); // count command state List commandStateCounts = @@ -278,18 +282,21 @@ public class DataAnalysisService { // init data map -// dataMap.put(ExecutionStatus.SUBMITTED_SUCCESS,commonCommand); -// dataMap.put(ExecutionStatus.RUNNING_EXEUTION,commonCommand); -// dataMap.put(ExecutionStatus.READY_PAUSE,commonCommand); -// dataMap.put(ExecutionStatus.PAUSE,commonCommand); -// dataMap.put(ExecutionStatus.READY_STOP,commonCommand); -// dataMap.put(ExecutionStatus.STOP,commonCommand); -// dataMap.put(ExecutionStatus.FAILURE,commonCommand); -// dataMap.put(ExecutionStatus.SUCCESS,commonCommand); -// dataMap.put(ExecutionStatus.NEED_FAULT_TOLERANCE,commonCommand); -// dataMap.put(ExecutionStatus.KILL,commonCommand); -// dataMap.put(ExecutionStatus.WAITTING_THREAD,commonCommand); -// dataMap.put(ExecutionStatus.WAITTING_DEPEND,commonCommand); + /** + * START_PROCESS, START_CURRENT_TASK_PROCESS, RECOVER_TOLERANCE_FAULT_PROCESS, RECOVER_SUSPENDED_PROCESS, + START_FAILURE_TASK_PROCESS,COMPLEMENT_DATA,SCHEDULER, REPEAT_RUNNING,PAUSE,STOP,RECOVER_WAITTING_THREAD; + */ + dataMap.put(CommandType.START_PROCESS,commonCommand); + dataMap.put(CommandType.START_CURRENT_TASK_PROCESS,commonCommand); + dataMap.put(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS,commonCommand); + dataMap.put(CommandType.RECOVER_SUSPENDED_PROCESS,commonCommand); + dataMap.put(CommandType.START_FAILURE_TASK_PROCESS,commonCommand); + dataMap.put(CommandType.COMPLEMENT_DATA,commonCommand); + dataMap.put(CommandType.SCHEDULER,commonCommand); + dataMap.put(CommandType.REPEAT_RUNNING,commonCommand); + dataMap.put(CommandType.PAUSE,commonCommand); + dataMap.put(CommandType.STOP,commonCommand); + dataMap.put(CommandType.RECOVER_WAITTING_THREAD,commonCommand); // put command state for (CommandCount executeStatusCount : commandStateCounts){ diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml index e3ab6b23c..370b0119b 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml @@ -9,7 +9,7 @@ limit 1 - select cmd.command_type as commandType, count(1) as count + select cmd.command_type as command_type, count(1) as count from t_ds_error_command cmd, t_ds_process_definition process where cmd.process_definition_id = process.id -- GitLab