root 2 years ago
parent
commit
1a81a341aa

+ 14 - 82
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/common/util/ProjectUtil.java

@@ -64,7 +64,6 @@ public class ProjectUtil {
     private StringRedisTemplate stringRedisTemplate;
 
 
-
     @SneakyThrows
     public void deleteYamlByProjectId(String projectId) {
         List<String> absolutePathList = FileUtil.listAbsolutePath(podYamlDirectory);
@@ -108,14 +107,10 @@ public class ProjectUtil {
 
     public void deletePod(String podName) {
         try {
-            String key = "pod:" + podName + ":node";
             // 先删除 redis key
-            RedisUtil.deleteByKey(stringRedisTemplate, "pod:" + podName + ":node");
             KubernetesUtil.deletePod(apiClient, kubernetesConfiguration.getNamespace(), podName);
-
             log.info("deletePod() 等待 pod " + podName + " 的资源释放完成。");
-            TimeUnit.SECONDS.sleep(10);
-            log.info("deletePod() 删除 pod 并删除 redis 键值对:" + key);
+            TimeUnit.SECONDS.sleep(7);
         } catch (ApiException apiException) {
             log.info("deletePod() pod " + podName + " 已删除。");
         } catch (Exception e) {
@@ -125,51 +120,15 @@ public class ProjectUtil {
     }
 
 
-
     public String getNodeNameOfPod(String podName) {
-        return stringRedisTemplate.opsForValue().get("pod:" + podName + ":node");
-    }
-
-    /**
-     * 更改一个名字继续启动
-     *
-     * @param projectId   项目 id
-     * @param nodeName    运行 pod 的节点名称
-     * @param lastPodName 即将删除的 pod 名称
-     */
-    @SneakyThrows
-    public void createNextPod2(String projectId, String nodeName, String lastPodName) {
-        //1 删除上一个 pod 和 redis 键值对 和 旧的 yaml 文件
-//        new Thread(() -> deletePod(lastPodName), "delete-" + lastPodName).start();
-        //
-        String cpuOrderString = stringRedisTemplate.opsForValue().get("pod:" + lastPodName + ":cpu");
-        deletePod(lastPodName);
-        List<String> list = FileUtil.listAbsolutePath(podYamlDirectory);
-        Iterator<String> iterator1 = list.iterator();
-        while (iterator1.hasNext()) {
-            String absolutePath = iterator1.next();
-            if (absolutePath.contains(nodeName) && absolutePath.contains(lastPodName)) {
-                FileUtil.rm(absolutePath);
-                list.remove(absolutePath);
-                break;
-            }
+        final String s = stringRedisTemplate.opsForValue().get("pod:" + podName + ":node");
+        if (StringUtil.isEmpty(s)) {
+            throw new RuntimeException("getNodeNameOfPod() 无法获取 pod 运行所在节点:" + "pod:" + podName + ":node");
         }
-        for (String absolutePath : list) {
-            if (absolutePath.contains(nodeName) && absolutePath.contains(projectId)) {
-                Optional.ofNullable(cpuOrderString).orElseThrow(() -> new RuntimeException("createNextPod2() pod " + lastPodName + " 缓存的 cpu 编号为空。"));
-                final String read = FileUtil.read(absolutePath);
-                final String replace = read.replace("cpu-order", "\"" + cpuOrderString + "\"");
-                FileUtil.writeStringToLocalFile(replace, absolutePath);
-                createPod2(absolutePath);
-                log.info("createNextPod2() 创建项目 " + projectId + " 在节点 " + nodeName + " 的下一个 pod。");
-                return;
-            }
-        }
-        // 如果当前节点没有下一个yaml,则返回一个并行度。
-        log.info("createNextPod2() 节点 " + nodeName + " 已经执行完被分配的项目 " + projectId + " 的所有 pod。");
-        addOneParallelismToNode(nodeName);
+        return s;
     }
 
+
     /**
      * 更改一个名字继续启动
      *
@@ -179,7 +138,7 @@ public class ProjectUtil {
      */
     @SneakyThrows
     public void createNextPod3(String projectId, String nodeName, String lastPodName) {
-        //1 删除上一个 pod 和 redis 键值对 和 旧的 yaml 文件
+        log.info("createNextPod3() 删除上一个 pod:projectId={},nodeName={},lastPodName={}", projectId, nodeName, lastPodName);
         String cpuOrderString = stringRedisTemplate.opsForValue().get("pod:" + lastPodName + ":cpu");
         deletePod(lastPodName);
         RedisUtil.deleteByKey(stringRedisTemplate, "pod:" + lastPodName + ":cpu");
@@ -200,39 +159,11 @@ public class ProjectUtil {
             FileUtil.writeStringToLocalFile(replace, absolutePath);
             // 创建 pod
             createPod3(yamlPathCacheKey);
-            log.info("createNextPod3() 创建项目 " + projectId + " 在节点 " + nodeName + " 的下一个 pod。");
+            log.info("createNextPod3() 创建项目 " + projectId + " 在节点 " + nodeName + " 的下一个 pod,使用 cpu 编号为 " + cpuOrderString);
         }
     }
 
 
-    /**
-     * @param nodeName       节点名称
-     * @param podName        pod 名称
-     * @param podYamlContent pod 文件内容
-     */
-    @SneakyThrows
-    public void createPod(String nodeName, String podName, String podYamlContent) {
-        stringRedisTemplate.opsForValue().set("pod:" + podName + ":node", nodeName);    // 将 pod 运行在哪个 node 上记录到 redis
-        String podYamlName = getPodYamlName(nodeName, podName);
-        String podYamlPath = podYamlDirectory + podYamlName;
-        FileUtil.writeStringToLocalFile(podYamlContent, podYamlPath);
-        KubernetesUtil.createNs(apiClient, kubernetesConfiguration.getNamespace());
-        KubernetesUtil.applyYaml(hostname, username, password, podYamlPath);
-//        下面这种执行方法报错
-//        V1Pod v1Pod = (V1Pod) Yaml.load(nextPodString);
-//        KubernetesUtil.createPod(apiClient, kubernetesNamespace, v1Pod);
-    }
-
-    /**
-     * @param podYamlPath yaml 文件地址
-     */
-    public void createPod2(String podYamlPath) {
-        String nodeName = new File(podYamlPath).getName().split("#")[0];
-        String podName = podYamlPath.split("#")[1].split("\\.")[0];
-        stringRedisTemplate.opsForValue().set("pod:" + podName + ":node", nodeName);    // 将 pod 运行在哪个 node 上记录到 redis
-        new Thread(() -> KubernetesUtil.applyYaml(hostname, username, password, podYamlPath), "create-" + podName).start();
-    }
-
     /**
      * @param redisKey yaml 地址的缓存 key
      */
@@ -538,7 +469,7 @@ public class ProjectUtil {
         } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
             userId = autoSubProjectMapper.selectCreateUserById(projectId);
         } else {
-            throw new RuntimeException("ProjectUtil--getRedisPrefixByProjectIdAndProjectType 未知的项目类型!");
+            throw new RuntimeException("getRedisPrefixByProjectIdAndProjectType() 未知的项目类型!");
         }
 
         //3 获取用户类型(管理员账户、管理员子账户、普通账户、普通子账户)(独占、共享)
@@ -587,10 +518,11 @@ public class ProjectUtil {
         String key = "node:" + nodeName + ":parallelism";
         String parallelismString = stringRedisTemplate.opsForValue().get(key);
         if (StringUtil.isEmpty(parallelismString)) {
-            throw new RuntimeException("ProjectUtil--addOneParallelismToNode redisKey " + key + " 为空。");
+            throw new RuntimeException("addOneParallelismToNode() redisKey " + key + " 为空。");
         }
-        int parallelism = Integer.parseInt(parallelismString);
-        stringRedisTemplate.opsForValue().set(key, (parallelism + 1) + "");
-        log.info("ProjectUtil--addOneParallelismToNode 归还节点 " + nodeName + " 并行度从 " + parallelism + " 加一。");
+        final int parallelismBefore = Integer.parseInt(parallelismString);
+        final int parallelismAfter = parallelismBefore + 1;
+        stringRedisTemplate.opsForValue().set(key, parallelismAfter + "");
+        log.info("addOneParallelismToNode() 归还节点 " + nodeName + " 并行度:" + parallelismBefore + " --> " + parallelismAfter);
     }
 }

+ 3 - 8
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/dao/manager/ProjectManager.java

@@ -53,8 +53,7 @@ public class ProjectManager {
                                  int kafkaPartition,
                                  long kafkaOffset,
                                  String isChoiceGpu,
-                                 int currentCount,
-                                 int cpuOrder
+                                 Integer cpuOrder
 
     ) {
         String podName = projectUtil.getRandomPodName(projectId);   // 生成 podName
@@ -82,7 +81,7 @@ public class ProjectManager {
             String replace13 = replace12.replace("node-name", nodeName);     // 指定 pod 运行节点
 
             String replace14;
-            if (currentCount == 0) {
+            if (cpuOrder != null) {
                 replace14 = replace13.replace("cpu-order", "\"" + cpuOrder + "\"");     // 指定 cpu 编号
                 stringRedisTemplate.opsForValue().set("pod:" + podName + ":cpu", cpuOrder + "");    //  pod 运行使用的 cpu编号
             } else {
@@ -90,11 +89,9 @@ public class ProjectManager {
             }
 
             if (DictConstants.USE_GPU.equals(isChoiceGpu)) {
-                log.info("项目 " + projectId + " 使用 gpu 生成视频");
                 String replace15 = replace14.replace("vtd-image", kubernetesConfiguration.getImageVtdGpu());
                 finalYaml = replace15.replace("vtd-command", kubernetesConfiguration.getCommandVtdGpu());
             } else if (DictConstants.NOT_USE_GPU.equals(isChoiceGpu)) {
-                log.info("项目 " + projectId + " 不使用 gpu 生成视频");
                 String replace15 = replace14.replace("vtd-image", kubernetesConfiguration.getImageVtdNogpu());
                 finalYaml = replace15.replace("vtd-command", kubernetesConfiguration.getCommandVtdNogpu());
             } else {
@@ -126,7 +123,7 @@ public class ProjectManager {
             String replace18 = replace17.replace("node-name", nodeName);     // 指定 pod 运行节点
 
             String replace19;
-            if (currentCount == 0) {
+            if (cpuOrder != null) {
                 replace19 = replace18.replace("cpu-order", "\"" + cpuOrder + "\"");     // 指定 cpu 编号
                 stringRedisTemplate.opsForValue().set("pod:" + podName + ":cpu", cpuOrder + "");    //  pod 运行使用的 cpu编号
             } else {
@@ -134,13 +131,11 @@ public class ProjectManager {
             }
 
             if (DictConstants.USE_GPU.equals(isChoiceGpu)) {
-                log.info("项目 " + projectId + " 使用 gpu 生成视频");
                 log.info("createTempYaml() k8s参数为:" + kubernetesConfiguration);
                 log.info("createTempYaml() yaml模板为:" + replace12);
                 String replace20 = replace19.replace("vtd-image", kubernetesConfiguration.getImageVtdGpu());
                 finalYaml = replace20.replace("vtd-command", kubernetesConfiguration.getCommandVtdCarsimGpu());
             } else if (DictConstants.NOT_USE_GPU.equals(isChoiceGpu)) {
-                log.info("项目 " + projectId + " 不使用 gpu 生成视频");
                 String replace20 = replace19.replace("vtd-image", kubernetesConfiguration.getImageVtdNogpu());
                 finalYaml = replace20.replace("vtd-command", kubernetesConfiguration.getCommandVtdCarsimNogpu());
             } else {

+ 4 - 15
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/dao/manager/TaskManager.java

@@ -170,7 +170,7 @@ public class TaskManager {
                     projectUtil.createNextPod3(projectId, nodeName, podName);
                 } else {
                     //如果项目已完成先把 pod 删除,并归还并行度
-                    KubernetesUtil.deletePod(apiClient, kubernetesConfiguration.getNamespace(), podName);
+                    KubernetesUtil.deletePod2(apiClient, kubernetesConfiguration.getNamespace(), podName);
                     projectUtil.addOneParallelismToNode(nodeName);
                 }
             } catch (Exception exception) {
@@ -513,27 +513,16 @@ public class TaskManager {
 //        SshUtil.execute(sessionKafka, topicDeleteCommand);
 //        SshUtil.stop(clientKafka, sessionKafka);
 
-
-//        // 归还并行度
-//        Set<String> nodeOfPodKeySet = RedisUtil.getKeySetByPrefix(stringRedisTemplate, "pod:project-" + projectId);
-//        for (String nodeOfPodKey : nodeOfPodKeySet) {
-//            String podName = nodeOfPodKey.split(":")[1];
-//            String nodeName = projectUtil.getNodeNameOfPod(podName);
-//            // 删除 pod
-//            projectUtil.deletePod(podName);
-//            // 节点并行度加一
-//            projectUtil.addOneParallelismToNode(nodeName);
-//        }
-
         // 删除 redis 中的 项目运行信息 键值对
         RedisUtil.deleteByPrefix(stringRedisTemplate, redisPrefix.getProjectRunningKey());
         RedisUtil.deleteByPrefix(stringRedisTemplate, "project:" + projectId);
+        RedisUtil.deleteByPrefix(stringRedisTemplate, "pod:project-" + projectId);
         // 删除剩余 yaml
         projectUtil.deleteYamlByProjectId(projectId);
         if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
-            log.info("TaskManager--done 手动运行项目 " + projectId + " 执行完成!");
+            log.info("done() 手动运行项目 " + projectId + " 执行完成!");
         } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
-            log.info("TaskManager--done 自动运行子项目 " + projectId + " 执行完成!");
+            log.info("done() 自动运行子项目 " + projectId + " 执行完成!");
         }
 
 

+ 15 - 12
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/web/consumer/ProjectConsumer.java

@@ -187,7 +187,6 @@ public class ProjectConsumer {
                     String xoscPathOfMinio = projectResultPathOfMinio + projectId + "/" + taskId + "/" + taskId + "." + xoscSuffix;
                     MinioUtil.downloadToFile(minioClient, bucketName, scenarioOsc, xoscPathOfLinux);
                     MinioUtil.uploadFromFile(minioClient, xoscPathOfLinux, bucketName, xoscPathOfMinio);
-                    log.info("cacheManualProject() 已经将 xosc 上传到 minio 的结果文件目录:" + xoscPathOfMinio);
 
                     String scenarioOdr = scenePO.getScenarioOdr();
                     String[] splitXodr = scenarioOdr.split("/");
@@ -198,7 +197,6 @@ public class ProjectConsumer {
                     String xodrPathOfMinio = projectResultPathOfMinio + projectId + "/" + taskId + "/" + taskId + "." + xodrSuffix;
                     MinioUtil.downloadToFile(minioClient, bucketName, scenarioOdr, xodrPathOfLinux);
                     MinioUtil.uploadFromFile(minioClient, xodrPathOfLinux, bucketName, xodrPathOfMinio);
-                    log.info("cacheManualProject() 已经将 xodr 上传到 minio 的结果文件目录:" + xodrPathOfMinio);
 
                     String scenarioOsgb = scenePO.getScenarioOsgb();
                     String[] splitOsgb = scenarioOsgb.split("/");
@@ -209,7 +207,7 @@ public class ProjectConsumer {
                     String osgbPathOfMinio = projectResultPathOfMinio + projectId + "/" + taskId + "/" + taskId + "." + osgbSuffix;
                     MinioUtil.downloadToFile(minioClient, bucketName, scenarioOsgb, osgbPathOfLinux);
                     MinioUtil.uploadFromFile(minioClient, osgbPathOfLinux, bucketName, osgbPathOfMinio);
-                    log.info("cacheManualProject() 已经将 osgb 上传到 minio 的结果文件目录:" + osgbPathOfMinio);
+                    log.info("cacheManualProject() 已经将 xosc、xodr、osgb 上传到 minio 的结果文件目录:" + projectResultPathOfMinio);
 
                     // 组装 task 消息
                     TaskTO taskTO = TaskTO.builder()
@@ -254,7 +252,7 @@ public class ProjectConsumer {
                                     .build())
                             .build();
                     FileUtil.writeStringToLocalFile(JsonUtil.beanToJson(taskTO), projectPath + taskId + ".json");
-                    log.info("createTaskAndFixData() 项目 " + projectId + " 将对象转成 json 保存到临时目录等待资源分配后执行:" + taskTO.getInfo().getTask_id());
+                    log.info("createTaskAndFixData() 项目 " + projectId + " 将任务消息转成 json 保存到临时目录等待资源分配后执行:" + taskTO.getInfo().getTask_id());
                 }
             }
             taskManager.batchInsertTask(taskList);
@@ -359,7 +357,7 @@ public class ProjectConsumer {
                             .build();
 
                     FileUtil.writeStringToLocalFile(JsonUtil.beanToJson(taskTO), projectPath + taskId + ".json");
-                    log.info("createTaskAndFixData() 项目 " + projectId + " 将对象转成 json 保存到临时目录等待资源分配后执行:" + taskTO.getInfo().getTask_id());
+                    log.info("createTaskAndFixData() 项目 " + projectId + " 将任务消息转成 json 保存到临时目录等待资源分配后执行:" + taskTO.getInfo().getTask_id());
                 }
             }
             taskManager.batchInsertTask(taskList);
@@ -438,6 +436,7 @@ public class ProjectConsumer {
         if (currentParallelismSum + parallelism <= simulationLicenseNumber) {
             run(projectMessageDTO, clusterId, redisPrefix.getProjectRunningKey(), redisPrefix.getProjectWaitingKey());
         } else {
+            log.info("cacheManualProject() 项目 " + projectId + " 并行度超出账户允许,加入等待队列,暂不执行。 ");
             wait(redisPrefix.getProjectWaitingKey(), projectMessageDTO);
         }
     }
@@ -559,15 +558,19 @@ public class ProjectConsumer {
                 throw new RuntimeException(errorMessage);
             }
             currentNodeTO.setCount(currentNodeTO.getCount() + 1);
-            // 获取 cpu 编号
-            int cpuOrder = nodeMap0.get(currentNodeName) - 1;
-            nodeMap0.put(currentNodeName, cpuOrder);
-
-            log.info("parseProject() 项目 " + projectId + " 准备创建 yaml:是否使用 gpu " + isChoiceGpu + ",当前节点名称为:" + currentNodeName + ",当前节点已创建 yaml 个数为:" + currentCount + ",当前 cpu 编号为:" + cpuOrder);
+            Integer cpuOrder = null;
+            if (currentCount == 0) {
+                // 根据各节点剩余并行度,倒序获取 cpu 编号
+                cpuOrder = nodeMap0.get(currentNodeName) - 1;
+                nodeMap0.put(currentNodeName, cpuOrder);
+            }
             // 只有准备启动(即 currentCount == 0)的时候才指定 cpu 编号
-            String yamlRedisKey = projectManager.createTempYaml(projectId, vehicleConfigId, modelType, algorithmDockerImage, currentNodeName, partition, offset, isChoiceGpu, currentCount, cpuOrder);
+            log.info("parseProject() 创建任务 " + taskId + " 的 yaml:是否使用 gpu (0是1否)" + isChoiceGpu + ",当前节点已创建 yaml 个数为:" + currentCount + ",当前节点名称为:" + currentNodeName + ",当前 cpu 编号为:" + cpuOrder);
+            String yamlRedisKey = projectManager.createTempYaml(projectId, vehicleConfigId, modelType, algorithmDockerImage, currentNodeName, partition, offset, isChoiceGpu, cpuOrder);
+
             if (currentCount == 0) {
-                log.info("parseProject() 加入到启动列表 " + yamlRedisKey);
+                String podName = yamlRedisKey.split(":")[yamlRedisKey.split(":").length - 1];
+                log.info("parseProject() 将 pod 加入到启动列表 " + podName);
                 yamlToRunRedisKeyList.add(yamlRedisKey);
             }
             messageNumber++;

+ 42 - 45
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/web/scheduler/ProjectScheduler.java

@@ -1,29 +1,26 @@
-//package com.css.simulation.resource.scheduler.scheduler;
+//package com.css.simulation.resource.scheduler.web.scheduler;
 //
 //import api.common.pojo.constants.DictConstants;
 //import api.common.pojo.dto.ProjectMessageDTO;
 //import api.common.util.CollectionUtil;
 //import api.common.util.JsonUtil;
 //import api.common.util.StringUtil;
-//import api.common.util.TimeUtil;
-//import com.css.simulation.resource.scheduler.configuration.kubernetes.KubernetesConfiguration;
-//import com.css.simulation.resource.scheduler.consumer.ProjectConsumer;
-//import com.css.simulation.resource.scheduler.mapper.*;
-//import com.css.simulation.resource.scheduler.pojo.po.ClusterPO;
-//import com.css.simulation.resource.scheduler.pojo.po.ProjectPO;
-//import com.css.simulation.resource.scheduler.pojo.po.TaskPO;
-//import com.css.simulation.resource.scheduler.pojo.po.UserPO;
-//import com.css.simulation.resource.scheduler.pojo.to.PrefixTO;
+//import com.css.simulation.resource.scheduler.common.configuration.kubernetes.KubernetesConfiguration;
+//import com.css.simulation.resource.scheduler.common.util.ProjectUtil;
+//import com.css.simulation.resource.scheduler.common.util.RedisUtil;
+//import com.css.simulation.resource.scheduler.dao.entity.ClusterPO;
+//import com.css.simulation.resource.scheduler.dao.entity.ProjectPO;
+//import com.css.simulation.resource.scheduler.dao.entity.UserPO;
+//import com.css.simulation.resource.scheduler.dao.mapper.*;
 //import com.css.simulation.resource.scheduler.service.TaskService;
-//import com.css.simulation.resource.scheduler.util.ProjectUtil;
-//import com.css.simulation.resource.scheduler.util.RedisUtil;
+//import com.css.simulation.resource.scheduler.service.domain.PrefixTO;
+//import com.css.simulation.resource.scheduler.web.consumer.ProjectConsumer;
 //import lombok.SneakyThrows;
 //import lombok.extern.slf4j.Slf4j;
 //import org.springframework.beans.factory.annotation.Value;
 //import org.springframework.data.redis.core.StringRedisTemplate;
 //import org.springframework.scheduling.annotation.Scheduled;
 //import org.springframework.stereotype.Component;
-//import org.springframework.transaction.annotation.Transactional;
 //
 //import javax.annotation.Resource;
 //import java.util.ArrayList;
@@ -176,37 +173,37 @@
 //    }
 //
 //
-//    /**
-//     * 处理 pod 超时
-//     * 同时也可处理 pod 莫名关闭,因为关闭之后也会超时
-//     */
-//    @Scheduled(fixedDelay = 60 * 1000)
-//    @Transactional
-//    public void taskTimeout() {
-//        //1 查询任务信息(需要过滤已经删除的项目,因为页面上删除项目不会删除任务)
-//        List<TaskPO> executingTaskList = taskMapper.selectByRunStateAndProjectIsNotDeleted(DictConstants.TASK_RUNNING);
-//        if (CollectionUtil.isEmpty(executingTaskList)) {
-//            return;
-//        }
-//        log.info("taskTimeout 正在运行的任务有:" + executingTaskList);
-//        for (TaskPO task : executingTaskList) {
-//            String userId = task.getCreateUserId();
-//            String projectId = task.getPId();
-//            String taskId = task.getId();
-//            PrefixTO redisPrefix = projectUtil.getRedisPrefixByUserIdAndProjectIdAndTaskId(userId, projectId, taskId);
-//            // 获取心跳时间
-//            String tickTime = stringRedisTemplate.opsForValue().get(redisPrefix.getTaskTickKey());
-//            if (StringUtil.isEmpty(tickTime)) {
-//                log.error(redisPrefix.getTaskTickKey() + ",该 key 的心跳时间为空!");
-//                continue;
-//            }
-//            long lastTickTime = Long.parseLong(tickTime);
-//            // 如果心跳超时则更改任务状态为 Aborted
-//            if (TimeUtil.getNow() - lastTickTime > Long.parseLong(kubernetesConfiguration.getPodTimeout())) {
-//                String podName = stringRedisTemplate.opsForValue().get(redisPrefix.getTaskPodKey());
-//                taskService.taskState(taskId, DictConstants.TASK_ABORTED, podName);
-//            }
-//        }
-//    }
+////    /**
+////     * 处理 pod 超时
+////     * 同时也可处理 pod 莫名关闭,因为关闭之后也会超时
+////     */
+////    @Scheduled(fixedDelay = 60 * 1000)
+////    @Transactional
+////    public void taskTimeout() {
+////        //1 查询任务信息(需要过滤已经删除的项目,因为页面上删除项目不会删除任务)
+////        List<TaskPO> executingTaskList = taskMapper.selectByRunStateAndProjectIsNotDeleted(DictConstants.TASK_RUNNING);
+////        if (CollectionUtil.isEmpty(executingTaskList)) {
+////            return;
+////        }
+////        log.info("taskTimeout 正在运行的任务有:" + executingTaskList);
+////        for (TaskPO task : executingTaskList) {
+////            String userId = task.getCreateUserId();
+////            String projectId = task.getPId();
+////            String taskId = task.getId();
+////            PrefixTO redisPrefix = projectUtil.getRedisPrefixByUserIdAndProjectIdAndTaskId(userId, projectId, taskId);
+////            // 获取心跳时间
+////            String tickTime = stringRedisTemplate.opsForValue().get(redisPrefix.getTaskTickKey());
+////            if (StringUtil.isEmpty(tickTime)) {
+////                log.error(redisPrefix.getTaskTickKey() + ",该 key 的心跳时间为空!");
+////                continue;
+////            }
+////            long lastTickTime = Long.parseLong(tickTime);
+////            // 如果心跳超时则更改任务状态为 Aborted
+////            if (TimeUtil.getNow() - lastTickTime > Long.parseLong(kubernetesConfiguration.getPodTimeout())) {
+////                String podName = stringRedisTemplate.opsForValue().get(redisPrefix.getTaskPodKey());
+////                taskService.taskState(taskId, DictConstants.TASK_ABORTED, podName);
+////            }
+////        }
+////    }
 //
 //}

+ 1 - 1
simulation-resource-video/src/main/java/com/css/simulation/resource/video/service/VideoService.java

@@ -283,7 +283,7 @@ public class VideoService {
                     }
                     if ("SceneGraphFile".equals(node2.getName())) {
                         Attribute name = node2.attribute("filepath");
-                        // name.setText(osgbPath);
+//                         name.setText(osgbPath);
                         name.setText("osgbPath");
                     }
                 }