You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by le...@apache.org on 2022/08/13 14:31:04 UTC
[dolphinscheduler] branch dev updated: [Fix-11465] Serial first, the last executing instance will be stopped (#11466)
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 13d400ceb6 [Fix-11465] Serial first, the last executing instance will be stopped (#11466)
13d400ceb6 is described below
commit 13d400ceb67d5a6a97f5422ef414e7da6673ac9d
Author: JiPeng Wang <10...@users.noreply.github.com>
AuthorDate: Sat Aug 13 22:30:56 2022 +0800
[Fix-11465] Serial first, the last executing instance will be stopped (#11466)
* Serial first, the last executing instance will be stopped
* ut fix
---
.../dolphinscheduler/service/process/ProcessServiceImpl.java | 11 ++---------
.../dolphinscheduler/service/process/ProcessServiceTest.java | 2 +-
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
index fc77bc30b3..4972ee393a 100644
--- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
+++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
@@ -341,16 +341,7 @@ public class ProcessServiceImpl implements ProcessService {
processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion(), Constants.RUNNING_PROCESS_STATE,
processInstance.getId());
- if (CollectionUtils.isEmpty(runningProcessInstances)) {
- processInstance.setState(WorkflowExecutionStatus.SUBMITTED_SUCCESS);
- saveProcessInstance(processInstance);
- return;
- }
for (ProcessInstance info : runningProcessInstances) {
- if (Objects.nonNull(info.getState()) && (WorkflowExecutionStatus.READY_STOP.equals(info.getState())
- || info.getState().isFinished())) {
- continue;
- }
info.setCommandType(CommandType.STOP);
info.addHistoryCmd(CommandType.STOP);
info.setState(WorkflowExecutionStatus.READY_STOP);
@@ -368,6 +359,8 @@ public class ProcessServiceImpl implements ProcessService {
}
}
}
+ processInstance.setState(WorkflowExecutionStatus.SUBMITTED_SUCCESS);
+ saveProcessInstance(processInstance);
}
}
diff --git a/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java b/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java
index 584368243e..190f869b1a 100644
--- a/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java
+++ b/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java
@@ -471,7 +471,7 @@ public class ProcessServiceTest {
Mockito.when(processInstanceMapper.updateById(processInstance)).thenReturn(1);
Mockito.when(commandMapper.deleteById(9)).thenReturn(1);
ProcessInstance processInstance10 = processService.handleCommand(host, command9);
- Assert.assertTrue(processInstance10 == null);
+ Assert.assertTrue(processInstance10 != null);
}
@Test(expected = ServiceException.class)