Browse Source

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
pull/2/head
qiaozhanwei 5 years ago committed by lgcareer
parent
commit
f5a5ea0577
  1. 45
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java
  2. 2
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml
  3. 2
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.xml

45
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.enums.Status;
import org.apache.dolphinscheduler.api.utils.Constants; import org.apache.dolphinscheduler.api.utils.Constants;
import org.apache.dolphinscheduler.common.enums.CommandType; 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.enums.UserType;
import org.apache.dolphinscheduler.common.queue.ITaskQueue; import org.apache.dolphinscheduler.common.queue.ITaskQueue;
import org.apache.dolphinscheduler.common.queue.TaskQueueFactory; import org.apache.dolphinscheduler.common.queue.TaskQueueFactory;
@ -246,15 +247,18 @@ public class DataAnalysisService {
Date start = null; Date start = null;
Date end = null; Date end = null;
try { if (startDate != null && endDate != null){
start = DateUtils.getScheduleDate(startDate); try {
end = DateUtils.getScheduleDate(endDate); start = DateUtils.getScheduleDate(startDate);
} catch (Exception e) { end = DateUtils.getScheduleDate(endDate);
logger.error(e.getMessage(),e); } catch (Exception e) {
putErrorRequestParamsMsg(result); logger.error(e.getMessage(),e);
return result; putErrorRequestParamsMsg(result);
return result;
}
} }
Integer[] projectIdArray = getProjectIdsArrays(loginUser, projectId); Integer[] projectIdArray = getProjectIdsArrays(loginUser, projectId);
// count command state // count command state
List<CommandCount> commandStateCounts = List<CommandCount> commandStateCounts =
@ -278,18 +282,21 @@ public class DataAnalysisService {
// init data map // init data map
// dataMap.put(ExecutionStatus.SUBMITTED_SUCCESS,commonCommand); /**
// dataMap.put(ExecutionStatus.RUNNING_EXEUTION,commonCommand); * START_PROCESS, START_CURRENT_TASK_PROCESS, RECOVER_TOLERANCE_FAULT_PROCESS, RECOVER_SUSPENDED_PROCESS,
// dataMap.put(ExecutionStatus.READY_PAUSE,commonCommand); START_FAILURE_TASK_PROCESS,COMPLEMENT_DATA,SCHEDULER, REPEAT_RUNNING,PAUSE,STOP,RECOVER_WAITTING_THREAD;
// dataMap.put(ExecutionStatus.PAUSE,commonCommand); */
// dataMap.put(ExecutionStatus.READY_STOP,commonCommand); dataMap.put(CommandType.START_PROCESS,commonCommand);
// dataMap.put(ExecutionStatus.STOP,commonCommand); dataMap.put(CommandType.START_CURRENT_TASK_PROCESS,commonCommand);
// dataMap.put(ExecutionStatus.FAILURE,commonCommand); dataMap.put(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS,commonCommand);
// dataMap.put(ExecutionStatus.SUCCESS,commonCommand); dataMap.put(CommandType.RECOVER_SUSPENDED_PROCESS,commonCommand);
// dataMap.put(ExecutionStatus.NEED_FAULT_TOLERANCE,commonCommand); dataMap.put(CommandType.START_FAILURE_TASK_PROCESS,commonCommand);
// dataMap.put(ExecutionStatus.KILL,commonCommand); dataMap.put(CommandType.COMPLEMENT_DATA,commonCommand);
// dataMap.put(ExecutionStatus.WAITTING_THREAD,commonCommand); dataMap.put(CommandType.SCHEDULER,commonCommand);
// dataMap.put(ExecutionStatus.WAITTING_DEPEND,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 // put command state
for (CommandCount executeStatusCount : commandStateCounts){ for (CommandCount executeStatusCount : commandStateCounts){

2
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml

@ -9,7 +9,7 @@
limit 1 limit 1
</select> </select>
<select id="countCommandState" resultType="org.apache.dolphinscheduler.dao.entity.CommandCount"> <select id="countCommandState" resultType="org.apache.dolphinscheduler.dao.entity.CommandCount">
select cmd.command_type as state, count(1) as count select cmd.command_type as command_type, count(1) as count
from t_ds_command cmd, t_ds_process_definition process from t_ds_command cmd, t_ds_process_definition process
where cmd.process_definition_id = process.id where cmd.process_definition_id = process.id
<if test="projectIdArray != null and projectIdArray.length != 0"> <if test="projectIdArray != null and projectIdArray.length != 0">

2
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.xml

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper"> <mapper namespace="org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper">
<select id="countCommandState" resultType="org.apache.dolphinscheduler.dao.entity.CommandCount"> <select id="countCommandState" resultType="org.apache.dolphinscheduler.dao.entity.CommandCount">
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 from t_ds_error_command cmd, t_ds_process_definition process
where cmd.process_definition_id = process.id where cmd.process_definition_id = process.id
<if test="projectIdArray != null and projectIdArray.length != 0"> <if test="projectIdArray != null and projectIdArray.length != 0">

Loading…
Cancel
Save