mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-02 04:08:31 +08:00
[Fix-11465] Serial first, the last executing instance will be stopped (#11466)
* Serial first, the last executing instance will be stopped * ut fix
This commit is contained in:
parent
4362fb8448
commit
13d400ceb6
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user