feat: throw exception when can't find retry instance's job

This commit is contained in:
tjq 2021-06-20 13:19:53 +08:00
parent 7feb4fc84e
commit f5ccbbb8cc
2 changed files with 1 additions and 7 deletions

View File

@ -97,12 +97,6 @@ public class DispatchService {
log.info("[Dispatcher-{}|{}] cancel dispatch due to instance has been dispatched", jobId, instanceId); log.info("[Dispatcher-{}|{}] cancel dispatch due to instance has been dispatched", jobId, instanceId);
return; return;
} }
// 任务信息已经被删除
if (jobInfo.getId() == null) {
log.warn("[Dispatcher-{}|{}] cancel dispatch due to job(id={}) has been deleted!", jobId, instanceId, jobId);
instanceManager.processFinishedInstance(instanceId, instanceInfo.getWfInstanceId(), FAILED, "can't find job by id " + jobId);
return;
}
Date now = new Date(); Date now = new Date();
String dbInstanceParams = instanceInfo.getInstanceParams() == null ? "" : instanceInfo.getInstanceParams(); String dbInstanceParams = instanceInfo.getInstanceParams() == null ? "" : instanceInfo.getInstanceParams();

View File

@ -420,7 +420,7 @@ public class WorkflowInstanceManager {
*/ */
private void runInstance(PEWorkflowDAG.Node node) { private void runInstance(PEWorkflowDAG.Node node) {
JobInfoDO jobInfo = jobInfoRepository.findById(node.getJobId()).orElseGet(JobInfoDO::new); JobInfoDO jobInfo = jobInfoRepository.findById(node.getJobId()).orElseThrow(() -> new PowerJobException("can't find job by jobId:" + node.getJobId()));
// 洗去时间表达式类型 // 洗去时间表达式类型
jobInfo.setTimeExpressionType(TimeExpressionType.WORKFLOW.getV()); jobInfo.setTimeExpressionType(TimeExpressionType.WORKFLOW.getV());
dispatchService.dispatch(jobInfo, node.getInstanceId()); dispatchService.dispatch(jobInfo, node.getInstanceId());