Browse Source

从强制成功的节点处启动-apiserver部分

1. 新添加executeType
2. 新添加对应的commandType
3. 修改controller对应的service部分
4. 补充processService中的verifyIsNeedCreateCommand的判断逻辑
pull/3/MERGE
Zhou Zheng 4 years ago
parent
commit
3fceee9570
  1. 3
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/ExecuteType.java
  2. 5
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
  3. 4
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/CommandType.java
  4. 1
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/ExecuteType.java

@ -29,8 +29,9 @@ public enum ExecuteType {
* 3 resume failure
* 4 stop
* 5 pause
* 6 resume from forced success
*/
NONE,REPEAT_RUNNING, RECOVER_SUSPENDED_PROCESS, START_FAILURE_TASK_PROCESS, STOP, PAUSE;
NONE,REPEAT_RUNNING, RECOVER_SUSPENDED_PROCESS, START_FAILURE_TASK_PROCESS, STOP, PAUSE, RESUME_FROM_FORCED_SUCCESS;
public static ExecuteType getEnum(int value){

5
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java

@ -17,6 +17,7 @@
package org.apache.dolphinscheduler.api.service;
import com.sun.org.apache.bcel.internal.generic.BREAKPOINT;
import org.apache.dolphinscheduler.api.enums.ExecuteType;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.common.Constants;
@ -264,6 +265,9 @@ public class ExecutorService extends BaseService{
result = updateProcessInstancePrepare(processInstance, CommandType.PAUSE, ExecutionStatus.READY_PAUSE);
}
break;
case RESUME_FROM_FORCED_SUCCESS:
result = insertCommand(loginUser, processInstanceId, processDefinition.getId(), CommandType.RESUME_FROM_FORCED_SUCCESS);
break;
default:
logger.error("unknown execute type : {}", executeType);
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "unknown execute type");
@ -310,6 +314,7 @@ public class ExecutorService extends BaseService{
}
break;
case START_FAILURE_TASK_PROCESS:
case RESUME_FROM_FORCED_SUCCESS:
if (executionStatus.typeIsFailure()) {
checkResult = true;
}

4
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/CommandType.java

@ -39,6 +39,7 @@ public enum CommandType {
* 8 pause a process
* 9 stop a process
* 10 recover waiting thread
* 11 resume process from forced-success task nodes
*/
START_PROCESS(0, "start a new process"),
START_CURRENT_TASK_PROCESS(1, "start a new process from current nodes"),
@ -50,7 +51,8 @@ public enum CommandType {
REPEAT_RUNNING(7, "repeat running a process"),
PAUSE(8, "pause a process"),
STOP(9, "stop a process"),
RECOVER_WAITTING_THREAD(10, "recover waiting thread");
RECOVER_WAITTING_THREAD(10, "recover waiting thread"),
RESUME_FROM_FORCED_SUCCESS(11, "resume process from forced-success task nodes");
CommandType(int code, String descp){
this.code = code;

1
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

@ -200,6 +200,7 @@ public class ProcessService {
cmdTypeMap.put(CommandType.REPEAT_RUNNING,1);
cmdTypeMap.put(CommandType.RECOVER_SUSPENDED_PROCESS,1);
cmdTypeMap.put(CommandType.START_FAILURE_TASK_PROCESS,1);
cmdTypeMap.put(CommandType.RESUME_FROM_FORCED_SUCCESS,1);
CommandType commandType = command.getCommandType();
if(cmdTypeMap.containsKey(commandType)){

Loading…
Cancel
Save