修改:hpc工作流完成通知优化

This commit is contained in:
yangyang01000846
2025-12-30 20:15:48 +08:00
parent 70693ae821
commit 82485bffcb
2 changed files with 11 additions and 12 deletions

View File

@@ -2,8 +2,6 @@ package com.sdm.pbs.schedule.hpc.hander;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.sdm.common.common.SdmResponse; import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.flowable.AsyncCallbackRequest;
import com.sdm.common.feign.inter.flowable.IFlowableFeignClient;
import com.sdm.common.log.CoreLogger; import com.sdm.common.log.CoreLogger;
import com.sdm.common.utils.DateUtils; import com.sdm.common.utils.DateUtils;
import com.sdm.common.utils.String2NumberUtil; import com.sdm.common.utils.String2NumberUtil;
@@ -28,9 +26,6 @@ public class FinishedStatusHandler implements JobStatusHandler {
@Autowired @Autowired
private HpcInstructionService hpcInstructionService; private HpcInstructionService hpcInstructionService;
@Autowired
private IFlowableFeignClient flowableFeignClient;
@Override @Override
public void handle(SimulationJob simJob, HpcJobStatusInfo statusInfo) { public void handle(SimulationJob simJob, HpcJobStatusInfo statusInfo) {
try { try {
@@ -55,12 +50,6 @@ public class FinishedStatusHandler implements JobStatusHandler {
// 通知成功修改状态 // 通知成功修改状态
newDbJob.setFileStatus("uploading"); newDbJob.setFileStatus("uploading");
simulationJobService.updateById(newDbJob); simulationJobService.updateById(newDbJob);
// todo 先直接流程结束
AsyncCallbackRequest asyncCallbackRequest = new AsyncCallbackRequest();
asyncCallbackRequest.setAsyncTaskId(newDbJob.getJobId());
asyncCallbackRequest.setResultJson("finished");
SdmResponse sdmResponse = flowableFeignClient.asyncCallback(asyncCallbackRequest);
CoreLogger.info("flowableFeignClient asyncCallback result:{}", JSONObject.toJSONString(sdmResponse));
} catch (Exception e) { } catch (Exception e) {
CoreLogger.error("HpcJobStatus finshed handle error:{},newDbJob:{},statusInfo:{}",e.getMessage(), CoreLogger.error("HpcJobStatus finshed handle error:{},newDbJob:{},statusInfo:{}",e.getMessage(),
JSONObject.toJSONString(simJob),JSONObject.toJSONString(statusInfo)); JSONObject.toJSONString(simJob),JSONObject.toJSONString(statusInfo));

View File

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sdm.common.common.SdmResponse; import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.flowable.AsyncCallbackRequest;
import com.sdm.common.entity.resp.PageDataResp; import com.sdm.common.entity.resp.PageDataResp;
import com.sdm.common.entity.resp.pbs.hpc.FileNodeInfo; import com.sdm.common.entity.resp.pbs.hpc.FileNodeInfo;
import com.sdm.common.feign.inter.flowable.IFlowableFeignClient;
import com.sdm.common.log.CoreLogger; import com.sdm.common.log.CoreLogger;
import com.sdm.common.utils.HpcCommandExcuteUtil; import com.sdm.common.utils.HpcCommandExcuteUtil;
import com.sdm.common.utils.PageUtils; import com.sdm.common.utils.PageUtils;
@@ -43,6 +45,9 @@ public class PbsServiceDecorator implements IPbsServiceDecorator {
@Autowired @Autowired
private HpcCommandExcuteUtil hpcCommandExcuteUtil; private HpcCommandExcuteUtil hpcCommandExcuteUtil;
@Autowired
private IFlowableFeignClient flowableFeignClient;
// 正则匹配%后的单词(\w+ 匹配字母、数字、下划线) // 正则匹配%后的单词(\w+ 匹配字母、数字、下划线)
private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("%(\\w+)"); private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("%(\\w+)");
@@ -319,7 +324,12 @@ public class PbsServiceDecorator implements IPbsServiceDecorator {
newDbJob.setFileStatus("finished"); newDbJob.setFileStatus("finished");
newDbJob.setUpdateTime(LocalDateTime.now()); newDbJob.setUpdateTime(LocalDateTime.now());
simulationJobService.updateById(newDbJob); simulationJobService.updateById(newDbJob);
// 回调通知工作流节点,继续 todo // 回调通知工作流节点
AsyncCallbackRequest asyncCallbackRequest = new AsyncCallbackRequest();
asyncCallbackRequest.setAsyncTaskId(newDbJob.getJobId());
asyncCallbackRequest.setResultJson("finished");
SdmResponse sdmResponse = flowableFeignClient.asyncCallback(asyncCallbackRequest);
CoreLogger.info("flowableFeignClient asyncCallback result:{}", JSONObject.toJSONString(sdmResponse));
return SdmResponse.success(true); return SdmResponse.success(true);
} }
return SdmResponse.success(false); return SdmResponse.success(false);