mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
[fix] fix the bug of can't stop workflow instance
This commit is contained in:
parent
7a6b8c0a0c
commit
eb9dc8f2ed
@ -48,12 +48,16 @@ public class WorkflowInstanceService {
|
|||||||
// 停止所有已启动且未完成的服务
|
// 停止所有已启动且未完成的服务
|
||||||
PEWorkflowDAG workflowDAG = JSONObject.parseObject(wfInstance.getDag(), PEWorkflowDAG.class);
|
PEWorkflowDAG workflowDAG = JSONObject.parseObject(wfInstance.getDag(), PEWorkflowDAG.class);
|
||||||
WorkflowDAGUtils.listRoots(workflowDAG).forEach(node -> {
|
WorkflowDAGUtils.listRoots(workflowDAG).forEach(node -> {
|
||||||
if (node.getInstanceId() != null && InstanceStatus.generalizedRunningStatus.contains(node.getStatus())) {
|
try {
|
||||||
log.debug("[WfInstance-{}] instance({}) is running, try to stop it now.", wfInstanceId, node.getInstanceId());
|
if (node.getInstanceId() != null && InstanceStatus.generalizedRunningStatus.contains(node.getStatus())) {
|
||||||
node.setStatus(InstanceStatus.STOPPED.getV());
|
log.debug("[WfInstance-{}] instance({}) is running, try to stop it now.", wfInstanceId, node.getInstanceId());
|
||||||
node.setResult(SystemInstanceResult.STOPPED_BY_USER);
|
node.setStatus(InstanceStatus.STOPPED.getV());
|
||||||
|
node.setResult(SystemInstanceResult.STOPPED_BY_USER);
|
||||||
|
|
||||||
instanceService.stopInstance(node.getInstanceId());
|
instanceService.stopInstance(node.getInstanceId());
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.warn("[WfInstance-{}] stop instance({}) failed.", wfInstanceId, JSONObject.toJSONString(node), e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user