|
@@ -92,7 +92,6 @@ public class TaskManager {
|
|
|
ProjectUtil projectUtil;
|
|
|
@Resource
|
|
|
VideoService videoService;
|
|
|
-
|
|
|
@Resource
|
|
|
private SqlSessionFactory sqlSessionFactory;
|
|
|
|
|
@@ -150,9 +149,18 @@ public class TaskManager {
|
|
|
taskMapper.updateFailStateWithStopTime(taskId, state, TimeUtil.getNowForMysql(), DictConstants.TASK_ERROR_REASON_3);
|
|
|
} else if ("PendingAnalysis".equals(state)) {
|
|
|
taskMapper.updateSuccessStateWithStopTime(taskId, state, TimeUtil.getNowForMysql());
|
|
|
- // 多线程创建视频和生成
|
|
|
- FutureTask<ResponseBodyVO<String>> videoTask = new FutureTask<>(() -> videoService.generateVideo(projectId, projectType, maxSimulationTime, taskId));
|
|
|
- new Thread(videoTask, "video-" + StringUtil.getRandomEightBitUUID()).start();
|
|
|
+ // 查询项目是否使用 cpu 生成视频
|
|
|
+ String isChoiceGpu = "1";
|
|
|
+ if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
+ isChoiceGpu = manualProjectMapper.selectIsChoiceGpuById(projectId);
|
|
|
+ }
|
|
|
+ if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
+ isChoiceGpu = autoSubProjectMapper.selectIsChoiceGpuById(projectId);
|
|
|
+ }
|
|
|
+ if (DictConstants.NO.equals(isChoiceGpu)) {
|
|
|
+ FutureTask<ResponseBodyVO<String>> videoTask = new FutureTask<>(() -> videoService.generateVideo(projectId, projectType, maxSimulationTime, taskId));
|
|
|
+ new Thread(videoTask, "video-" + StringUtil.getRandomEightBitUUID()).start();
|
|
|
+ }
|
|
|
}
|
|
|
// -------------------------------- 判断项目是否结束 --------------------------------
|
|
|
ProjectMessageDTO projectMessageDTO = JsonUtil.jsonToBean(stringRedisTemplate.opsForValue().get(redisPrefix.getProjectRunningKey()), ProjectMessageDTO.class);
|