|
|
@ -345,25 +345,29 @@ public class ProcessServiceImpl implements ProcessService { |
|
|
|
} else if (processDefinition.getExecutionType().typeIsSerialPriority()) { |
|
|
|
} else if (processDefinition.getExecutionType().typeIsSerialPriority()) { |
|
|
|
List<ProcessInstance> runningProcessInstances = this.processInstanceMapper.queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId(processInstance.getProcessDefinitionCode(), |
|
|
|
List<ProcessInstance> runningProcessInstances = this.processInstanceMapper.queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId(processInstance.getProcessDefinitionCode(), |
|
|
|
processInstance.getProcessDefinitionVersion(), Constants.RUNNING_PROCESS_STATE, processInstance.getId()); |
|
|
|
processInstance.getProcessDefinitionVersion(), Constants.RUNNING_PROCESS_STATE, processInstance.getId()); |
|
|
|
if (CollectionUtils.isNotEmpty(runningProcessInstances)) { |
|
|
|
if (CollectionUtils.isEmpty(runningProcessInstances)) { |
|
|
|
for (ProcessInstance info : runningProcessInstances) { |
|
|
|
processInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS); |
|
|
|
info.setCommandType(CommandType.STOP); |
|
|
|
saveProcessInstance(processInstance); |
|
|
|
info.addHistoryCmd(CommandType.STOP); |
|
|
|
return; |
|
|
|
info.setState(ExecutionStatus.READY_STOP); |
|
|
|
} |
|
|
|
int update = updateProcessInstance(info); |
|
|
|
for (ProcessInstance info : runningProcessInstances) { |
|
|
|
// determine whether the process is normal
|
|
|
|
if (Objects.nonNull(info.getState()) && (ExecutionStatus.READY_STOP.equals(info.getState()) || info.getState().typeIsFinished())) { |
|
|
|
if (update > 0) { |
|
|
|
continue; |
|
|
|
String host = info.getHost(); |
|
|
|
} |
|
|
|
String address = host.split(":")[0]; |
|
|
|
info.setCommandType(CommandType.STOP); |
|
|
|
int port = Integer.parseInt(host.split(":")[1]); |
|
|
|
info.addHistoryCmd(CommandType.STOP); |
|
|
|
StateEventChangeCommand stateEventChangeCommand = new StateEventChangeCommand( |
|
|
|
info.setState(ExecutionStatus.READY_STOP); |
|
|
|
|
|
|
|
int update = updateProcessInstance(info); |
|
|
|
|
|
|
|
// determine whether the process is normal
|
|
|
|
|
|
|
|
if (update > 0) { |
|
|
|
|
|
|
|
StateEventChangeCommand stateEventChangeCommand = new StateEventChangeCommand( |
|
|
|
info.getId(), 0, info.getState(), info.getId(), 0 |
|
|
|
info.getId(), 0, info.getState(), info.getId(), 0 |
|
|
|
); |
|
|
|
); |
|
|
|
try { |
|
|
|
try { |
|
|
|
stateEventCallbackService.sendResult(address, port, stateEventChangeCommand.convert2Command()); |
|
|
|
Host host = new Host(info.getHost()); |
|
|
|
} catch (Exception e) { |
|
|
|
stateEventCallbackService.sendResult(host, stateEventChangeCommand.convert2Command()); |
|
|
|
logger.error("sendResultError"); |
|
|
|
} catch (Exception e) { |
|
|
|
} |
|
|
|
logger.error("sendResultError",e ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -3037,13 +3041,11 @@ public class ProcessServiceImpl implements ProcessService { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void sendStartTask2Master(ProcessInstance processInstance, int taskId, |
|
|
|
public void sendStartTask2Master(ProcessInstance processInstance, int taskId, |
|
|
|
org.apache.dolphinscheduler.remote.command.CommandType taskType) { |
|
|
|
org.apache.dolphinscheduler.remote.command.CommandType taskType) { |
|
|
|
String host = processInstance.getHost(); |
|
|
|
|
|
|
|
String address = host.split(":")[0]; |
|
|
|
|
|
|
|
int port = Integer.parseInt(host.split(":")[1]); |
|
|
|
|
|
|
|
TaskEventChangeCommand taskEventChangeCommand = new TaskEventChangeCommand( |
|
|
|
TaskEventChangeCommand taskEventChangeCommand = new TaskEventChangeCommand( |
|
|
|
processInstance.getId(), taskId |
|
|
|
processInstance.getId(), taskId |
|
|
|
); |
|
|
|
); |
|
|
|
stateEventCallbackService.sendResult(address, port, taskEventChangeCommand.convert2Command(taskType)); |
|
|
|
Host host = new Host(processInstance.getHost()); |
|
|
|
|
|
|
|
stateEventCallbackService.sendResult(host, taskEventChangeCommand.convert2Command(taskType)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|