This is an automated email from the ASF dual-hosted git repository.
leonbao pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 3b72c6efe7 [Improvement]Add a stop function when you are ready to do
pause operation (#11543)
3b72c6efe7 is described below
commit 3b72c6efe777bb4f1f7310928cf3ee525c9a6ea1
Author: juzimao <[email protected]>
AuthorDate: Thu Aug 18 21:32:53 2022 +0800
[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
---
.../dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | 6 +++++-
.../dolphinscheduler/common/enums/WorkflowExecutionStatus.java | 4 ++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
index 86483f484d..3dbfe97619 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
+++
b/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;
switch (executeType) {
case PAUSE:
- case STOP:
if (executionStatus.isRunning()) {
checkResult = true;
}
break;
+ case STOP:
+ if (executionStatus.canStop()) {
+ checkResult = true;
+ }
+ break;
case REPEAT_RUNNING:
if (executionStatus.isFinished()) {
checkResult = true;
diff --git
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/WorkflowExecutionStatus.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/WorkflowExecutionStatus.java
index 67be58c7e6..65e2b8d946 100644
---
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/WorkflowExecutionStatus.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/WorkflowExecutionStatus.java
@@ -71,6 +71,10 @@ public enum WorkflowExecutionStatus {
return this == RUNNING_EXECUTION;
}
+ public boolean canStop() {
+ return this == RUNNING_EXECUTION || this == READY_PAUSE;
+ }
+
public boolean isFinished() {
// todo: do we need to remove pause/block in finished judge?
return isSuccess() || isFailure() || isStop() || isPause() ||
isBlock();