|
@@ -300,47 +300,12 @@ public class PipelineServiceImpl implements PipelineService {
|
|
//异常不阻塞其他分支执行
|
|
//异常不阻塞其他分支执行
|
|
try {
|
|
try {
|
|
//保存数据到mysql
|
|
//保存数据到mysql
|
|
- CuTaskExample example = new CuTaskExample();
|
|
|
|
- example.createCriteria().andTaskIdEqualTo(taskId);
|
|
|
|
- CuTask cuTask = new CuTask();
|
|
|
|
- cuTask.setOutput(result);
|
|
|
|
- cuTask.setTaskStatus(TaskStatusEnum.SUCCESS.getValue());
|
|
|
|
- int update = cuTaskMapper.updateByExampleSelective(cuTask, example);
|
|
|
|
- if (update <= 0) {
|
|
|
|
- log.error("step execute update error step = {}, result = {} update = {}", JSON.toJSONString(step), result, update);
|
|
|
|
- }
|
|
|
|
- Map<String, Object> logMap = new HashMap<>();
|
|
|
|
- logMap.put("video_id", videoId);
|
|
|
|
- logMap.put("data", result);
|
|
|
|
- logMap.put("status", "success");
|
|
|
|
- logMap.put("taskId", taskId);
|
|
|
|
- if (Objects.nonNull(dto.getExtMap())) {
|
|
|
|
- logMap.putAll(dto.getExtMap());
|
|
|
|
- }
|
|
|
|
- loghubService.asyncSubmitLog(aliyunLogProject, aliyunLogStoreResult, "", logMap);
|
|
|
|
-
|
|
|
|
|
|
+ updateTaskResult(taskId, result, reason, videoId, dto.getExtMap(), true);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("step execute update error step = {}, result = {}", e, JSON.toJSONString(step), result);
|
|
log.error("step execute update error step = {}, result = {}", e, JSON.toJSONString(step), result);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- CuTaskExample example = new CuTaskExample();
|
|
|
|
- example.createCriteria().andTaskIdEqualTo(taskId);
|
|
|
|
- CuTask cuTask = new CuTask();
|
|
|
|
- cuTask.setReason(reason);
|
|
|
|
- cuTask.setTaskStatus(TaskStatusEnum.FAILURE.getValue());
|
|
|
|
- int update = cuTaskMapper.updateByExampleSelective(cuTask, example);
|
|
|
|
- if (update <= 0) {
|
|
|
|
- log.error("step execute update error step = {}, result = {} update = {}", JSON.toJSONString(step), result, update);
|
|
|
|
- }
|
|
|
|
- Map<String, Object> logMap = new HashMap<>();
|
|
|
|
- logMap.put("video_id", videoId);
|
|
|
|
- logMap.put("error_msg", reason);
|
|
|
|
- logMap.put("status", "failure");
|
|
|
|
- logMap.put("taskId", taskId);
|
|
|
|
- if (Objects.nonNull(dto.getExtMap())) {
|
|
|
|
- logMap.putAll(dto.getExtMap());
|
|
|
|
- }
|
|
|
|
- loghubService.asyncSubmitLog(aliyunLogProject, aliyunLogStoreResult, "", logMap);
|
|
|
|
|
|
+ updateTaskResult(taskId, result, reason, videoId, dto.getExtMap(), false);
|
|
}
|
|
}
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -351,6 +316,38 @@ public class PipelineServiceImpl implements PipelineService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void updateTaskResult(String taskId, String result, String reason, Long videoId, Map<String, Object> extMap, boolean isSuccess) {
|
|
|
|
+ CuTaskExample example = new CuTaskExample();
|
|
|
|
+ example.createCriteria().andTaskIdEqualTo(taskId);
|
|
|
|
+ CuTask cuTask = new CuTask();
|
|
|
|
+ if (isSuccess) {
|
|
|
|
+ cuTask.setOutput(result);
|
|
|
|
+ cuTask.setTaskStatus(TaskStatusEnum.SUCCESS.getValue());
|
|
|
|
+ } else {
|
|
|
|
+ cuTask.setReason(reason);
|
|
|
|
+ cuTask.setTaskStatus(TaskStatusEnum.FAILURE.getValue());
|
|
|
|
+ }
|
|
|
|
+ int updateCount = cuTaskMapper.updateByExampleSelective(cuTask, example);
|
|
|
|
+ if (updateCount <= 0) {
|
|
|
|
+ log.error("updateTaskResult execute update error taskId = {} videoId = {}, result = {} reason = {} updateCount = {}", taskId, videoId, result, reason, updateCount);
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> logMap = new HashMap<>();
|
|
|
|
+ logMap.put("video_id", videoId);
|
|
|
|
+ logMap.put("taskId", taskId);
|
|
|
|
+ if (isSuccess) {
|
|
|
|
+ logMap.put("data", result);
|
|
|
|
+ logMap.put("status", "success");
|
|
|
|
+ } else {
|
|
|
|
+ logMap.put("error_msg", reason);
|
|
|
|
+ logMap.put("status", "failure");
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(extMap)) {
|
|
|
|
+ logMap.putAll(extMap);
|
|
|
|
+ }
|
|
|
|
+ loghubService.asyncSubmitLog(aliyunLogProject, aliyunLogStoreResult, "", logMap);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 执行step 动作
|
|
* 执行step 动作
|
|
*
|
|
*
|