Browse Source

[Improvement]Add a stop function when you are ready to do pause operation (#11543)

* add can stop for execute state machine

* add execute type check for pause operation
3.1.0-release
juzimao 2 years ago committed by GitHub
parent
commit
3b72c6efe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
  2. 4
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/WorkflowExecutionStatus.java

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java

@ -478,11 +478,15 @@ public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorServ
boolean checkResult = false; boolean checkResult = false;
switch (executeType) { switch (executeType) {
case PAUSE: case PAUSE:
case STOP:
if (executionStatus.isRunning()) { if (executionStatus.isRunning()) {
checkResult = true; checkResult = true;
} }
break; break;
case STOP:
if (executionStatus.canStop()) {
checkResult = true;
}
break;
case REPEAT_RUNNING: case REPEAT_RUNNING:
if (executionStatus.isFinished()) { if (executionStatus.isFinished()) {
checkResult = true; checkResult = true;

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

@ -71,6 +71,10 @@ public enum WorkflowExecutionStatus {
return this == RUNNING_EXECUTION; return this == RUNNING_EXECUTION;
} }
public boolean canStop() {
return this == RUNNING_EXECUTION || this == READY_PAUSE;
}
public boolean isFinished() { public boolean isFinished() {
// todo: do we need to remove pause/block in finished judge? // todo: do we need to remove pause/block in finished judge?
return isSuccess() || isFailure() || isStop() || isPause() || isBlock(); return isSuccess() || isFailure() || isStop() || isPause() || isBlock();

Loading…
Cancel
Save