Forráskód Böngészése

将项目运行节点拆分成GPU节点和CPU节点

LingxinMeng 2 éve
szülő
commit
693bfa66ce

+ 1 - 0
api-common/src/main/java/api/common/pojo/constants/DictConstants.java

@@ -59,6 +59,7 @@ public class DictConstants {
 
     public static final String USE_GPU = "0";//是
     public static final String NOT_USE_GPU = "1";//否
+    public static final String USE_CPU = "1";//否
 
 
     public static final String IS_SHARED = "1";//是

+ 3 - 3
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/configuration/kubernetes/KubernetesConfiguration.java

@@ -29,9 +29,9 @@ public class KubernetesConfiguration {
     private String commandVtdCarsimNogpu;
     private String carsimImage;
     private String carsimCommand;
-    private List<NodeModel> nodeList;
-    private List<NodeModel> cpuList;
-    private List<NodeModel> gpuList;
+//    private List<NodeModel> nodeList;
+    private List<NodeModel> cpuNodeList;
+    private List<NodeModel> gpuNodeList;
 
     @Bean
     @SneakyThrows

+ 11 - 18
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ProjectConsumer.java

@@ -99,19 +99,14 @@ public class ProjectConsumer {
     public void createTaskAndFixData(ProjectMessageDTO projectMessageDTO) {
         //* -------------------------------- 0 读取消息,创建临时目录 --------------------------------
         String projectId = projectMessageDTO.getProjectId();                // 手动执行项目 id 或 自动执行子项目 id
-        String modelType = projectMessageDTO.getModelType();                // 模型类型,1 动力学模型 2 carsim模型
-        String packageId = projectMessageDTO.getScenePackageId();           // 场景测试包 id
-        String vehicleConfigId = projectMessageDTO.getVehicleConfigId();    // 模型配置 id
-        String algorithmId = projectMessageDTO.getAlgorithmId();            // 模型配置 id
-        long videoTime = projectMessageDTO.getMaxSimulationTime();          // 结果视频的时长
         String projectType = projectMessageDTO.getType();                   // 项目类型
         try {
-            String userId = "";  // 用户 id
-            if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
-                userId = manualProjectMapper.selectCreateUserById(projectId);
-            } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
-                userId = autoSubProjectMapper.selectCreateUserById(projectId);
-            }
+            String modelType = projectMessageDTO.getModelType();                // 模型类型,1 动力学模型 2 carsim模型
+            String packageId = projectMessageDTO.getScenePackageId();           // 场景测试包 id
+            String vehicleConfigId = projectMessageDTO.getVehicleConfigId();    // 模型配置 id
+            String algorithmId = projectMessageDTO.getAlgorithmId();            // 模型配置 id
+            long videoTime = projectMessageDTO.getMaxSimulationTime();          // 结果视频的时长
+            String userId = projectUtil.getUserIdByProjectIdAndProjectType(projectId, projectType);
             String projectPath = linuxTempPath + "project/" + projectId + "/";
             FileUtil.mkdir(projectPath);
             //5 将该 project 下所有旧的指标得分删除。
@@ -308,7 +303,6 @@ public class ProjectConsumer {
         String projectId = projectMessageDTO.getProjectId();    // 手动执行项目 id 或 自动执行子项目 id
         long parallelism = projectMessageDTO.getParallelism();   // 项目并行度
         String projectType = projectMessageDTO.getType(); // 项目类型
-        String projectPath = linuxTempPath + "project/" + projectId + "/";
         //2 根据 projectId 获取创建用户 id
         String userId;
         if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
@@ -353,7 +347,7 @@ public class ProjectConsumer {
             if (projectUtil.getUsingLicenseNumber(userId, DictConstants.MODEL_TYPE_VTD) + parallelism <= clusterEntity.getNumSimulationLicense()) {
                 run(projectMessageDTO, userId, modelType, clusterEntity.getId(), redisPrefix.getProjectRunningKey(), redisPrefix.getProjectWaitingKey());
             } else {
-                log.info("项目 " + projectId + " 并行度超出账户允许,加入等待队列,暂不执行。 ");
+                log.info("VTD 项目 " + projectId + " 并行度超出账户允许,加入等待队列,暂不执行。 ");
                 wait(redisPrefix.getProjectWaitingKey(), projectMessageDTO);
             }
         } else if (DictConstants.MODEL_TYPE_CARSIM.equals(modelType)) {
@@ -361,11 +355,10 @@ public class ProjectConsumer {
 //                // 获取正在运行的项目的并行度总和
 //                int currentParallelismSum = projectUtil.getCurrentParallelismSum(redisPrefix.getClusterRunningPrefix());
             // 如果执行后的并行度总和小于最大节点数则执行,否则不执行
-            if (projectUtil.getUsingLicenseNumber(userId, DictConstants.MODEL_TYPE_VTD) + parallelism <= clusterEntity.getNumSimulationLicense()
-                    && projectUtil.getUsingLicenseNumber(userId, DictConstants.MODEL_TYPE_CARSIM) + parallelism <= clusterEntity.getNumDynamicLicense()) {
+            if (projectUtil.getUsingLicenseNumber(userId, DictConstants.MODEL_TYPE_VTD) + parallelism <= clusterEntity.getNumSimulationLicense() && projectUtil.getUsingLicenseNumber(userId, DictConstants.MODEL_TYPE_CARSIM) + parallelism <= clusterEntity.getNumDynamicLicense()) {
                 run(projectMessageDTO, userId, modelType, clusterEntity.getId(), redisPrefix.getProjectRunningKey(), redisPrefix.getProjectWaitingKey());
             } else {
-                log.info("项目 " + projectId + " 并行度超出账户允许,加入等待队列,暂不执行。 ");
+                log.info("CARSIM 项目 " + projectId + " 并行度超出账户允许,加入等待队列,暂不执行。 ");
                 wait(redisPrefix.getProjectWaitingKey(), projectMessageDTO);
             }
         } else {
@@ -424,8 +417,8 @@ public class ProjectConsumer {
         projectMessageDTO.setTaskCompleted(0);
         // 设置任务数量之后,获取运行节点,并将项目运行信息放入 redis
         //1 获取剩余并行度和即将使用的各node的并行度
-        Map<String, Integer> nodeMap0 = projectUtil.getNodeMap();
-        Map<String, Integer> nodeMap = projectUtil.getNodeMapToUse(Math.min(currentParallelism, taskTotal));
+        Map<String, Integer> nodeMap0 = projectUtil.getNodeMap(isChoiceGpu);
+        Map<String, Integer> nodeMap = projectUtil.getNodeMapToUse(isChoiceGpu, Math.min(currentParallelism, taskTotal));
         //2 将指定 node 的并行度减少
         nodeMap.keySet().forEach(nodeName -> projectUtil.decrementParallelismOfGpuNode(nodeName, nodeMap.get(nodeName)));
         // 重新设置实际使用的并行度并保存到 redis

+ 156 - 71
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/util/ProjectUtil.java

@@ -150,7 +150,7 @@ public class ProjectUtil {
             final String yamlPathCacheKey = new ArrayList<>(yamlPathCacheKeySet).get(0);
             final String absolutePath = stringRedisTemplate.opsForValue().get(yamlPathCacheKey);
             // 修改 cpu 编号
-            Optional.ofNullable(cpuOrderString).orElseThrow(() -> new RuntimeException("createNextPod2() pod " + lastPodName + " 缓存的 cpu 编号为空。"));
+            Optional.ofNullable(cpuOrderString).orElseThrow(() -> new RuntimeException("pod " + lastPodName + " 缓存的 cpu 编号为空。"));
             final String read = FileUtil.read(absolutePath);
             final String replace = read.replace("cpu-order", "\"" + cpuOrderString + "\"");
             FileUtil.writeStringToLocalFile(replace, absolutePath);
@@ -237,70 +237,168 @@ public class ProjectUtil {
      *
      * @return 节点映射(节点名,并行度)
      */
-    public Map<String, Integer> getNodeMap() {
-        List<NodeModel> initialNodeList = kubernetesConfiguration.getNodeList(); // 预设并行度的节点列表
-        log.info("预设并行度的节点列表为:" + initialNodeList);
+    public Map<String, Integer> getNodeMap(String isChoiceGpu) {
         Map<String, Integer> resultNodeMap = new HashMap<>();    // 用于执行的节点映射(节点名,并行度)
-        for (NodeModel kubernetesNodeSource : initialNodeList) {
-            NodeModel kubernetesNodeCopy = kubernetesNodeSource.clone();
-            String nodeName = kubernetesNodeCopy.getHostname();
-            int maxParallelism = kubernetesNodeCopy.getParallelism();
-            String restParallelismKey = "gpu-node:" + nodeName + ":parallelism";
-            String restParallelismString = stringRedisTemplate.opsForValue().get(restParallelismKey);
-            int restParallelism;
-            if (restParallelismString == null) {    // 如果剩余可用并行度没有值,说明是第一次查询,则重置成最大并行度的预设值
-                restParallelism = maxParallelism;
-                stringRedisTemplate.opsForValue().set(restParallelismKey, restParallelism + "");
-            } else {
-                restParallelism = Integer.parseInt(restParallelismString);
+        if (DictConstants.USE_GPU.equals(isChoiceGpu)) {
+            List<NodeModel> initialNodeList = kubernetesConfiguration.getGpuNodeList();
+            log.info("预设并行度的GPU节点列表为:" + initialNodeList);
+            for (NodeModel kubernetesNodeSource : initialNodeList) {
+                NodeModel kubernetesNodeCopy = kubernetesNodeSource.clone();
+                String nodeName = kubernetesNodeCopy.getHostname();
+                int maxParallelism = kubernetesNodeCopy.getParallelism();
+                String restParallelismKey = "gpu-node:" + nodeName + ":parallelism";
+                String restParallelismString = stringRedisTemplate.opsForValue().get(restParallelismKey);
+                int restParallelism;
+                if (restParallelismString == null) {    // 如果剩余可用并行度没有值,说明是第一次查询,则重置成最大并行度的预设值
+                    restParallelism = maxParallelism;
+                    stringRedisTemplate.opsForValue().set(restParallelismKey, String.valueOf(restParallelism));
+                } else {
+                    restParallelism = Integer.parseInt(restParallelismString);
+                }
+                resultNodeMap.put(nodeName, restParallelism);
+            }
+            log.info("剩余并行度的GPU节点列表为:" + resultNodeMap);
+        } else if (DictConstants.USE_CPU.equals(isChoiceGpu)) {
+            List<NodeModel> initialNodeList = kubernetesConfiguration.getCpuNodeList();
+            log.info("预设并行度的CPU节点列表为:" + initialNodeList);
+            for (NodeModel kubernetesNodeSource : initialNodeList) {
+                NodeModel kubernetesNodeCopy = kubernetesNodeSource.clone();
+                String nodeName = kubernetesNodeCopy.getHostname();
+                int maxParallelism = kubernetesNodeCopy.getParallelism();
+                String restParallelismKey = "cpu-node:" + nodeName + ":parallelism";
+                String restParallelismString = stringRedisTemplate.opsForValue().get(restParallelismKey);
+                int restParallelism;
+                if (restParallelismString == null) {    // 如果剩余可用并行度没有值,说明是第一次查询,则重置成最大并行度的预设值
+                    restParallelism = maxParallelism;
+                    stringRedisTemplate.opsForValue().set(restParallelismKey, String.valueOf(restParallelism));
+                } else {
+                    restParallelism = Integer.parseInt(restParallelismString);
+                }
+                resultNodeMap.put(nodeName, restParallelism);
             }
-            resultNodeMap.put(nodeName, restParallelism);
+            log.info("剩余并行度的CPU节点列表为:" + resultNodeMap);
         }
-        log.info("剩余并行度的节点列表为:" + resultNodeMap);
         return resultNodeMap;
     }
 
 
     /**
-     * 获取集群剩余并行度
+     * 根据并行度获取用于执行的节点列表
+     * 根据剩余可用并行度降序排序
      *
-     * @return 集群剩余并行度
+     * @return 节点映射(节点名,并行度)
      */
-    public int getRestParallelism() {
-        List<NodeModel> initialNodeList = kubernetesConfiguration.getNodeList(); // 预设并行度的节点列表
-        // 遍历所有节点,获取还有剩余并行度的节点
-        List<NodeModel> restNodeList = new ArrayList<>();    // 剩余并行度的节点列表
-        for (NodeModel kubernetesNodeSource : initialNodeList) {
-            NodeModel kubernetesNodeCopy = kubernetesNodeSource.clone();
-            String nodeName = kubernetesNodeCopy.getHostname();   // 节点名称
-            int maxParallelism = kubernetesNodeCopy.getParallelism();
-            String restParallelismString = stringRedisTemplate.opsForValue().get("gpu-node:" + nodeName + ":parallelism");// 获取节点剩余并行度的 key
-            // -------------------------------- Comment --------------------------------
-            int restParallelism;
-            if (restParallelismString == null || Integer.parseInt(restParallelismString) > maxParallelism) {    // 如果剩余可用并行度没有值,说明是第一次查询,则重置成最大并行度的预设值
-                restParallelism = maxParallelism;
-                stringRedisTemplate.opsForValue().set("gpu-node:" + nodeName + ":parallelism", restParallelism + "");
-            } else {
-                restParallelism = Integer.parseInt(restParallelismString);
-                kubernetesNodeCopy.setParallelism(restParallelism);
+    public Map<String, Integer> getNodeMapToUse(String isChoiceGpu, int parallelism) {
+        List<NodeModel> initialNodeList; // 预设并行度的节点列表
+        if (DictConstants.USE_GPU.equals(isChoiceGpu)) {
+            initialNodeList = kubernetesConfiguration.getGpuNodeList();
+            log.info("预设并行度的节点列表为:" + initialNodeList);
+            // 遍历所有节点,获取还有剩余并行度的节点
+            List<NodeModel> restNodeList = new ArrayList<>();    // 剩余并行度的节点列表
+            for (NodeModel kubernetesNodeSource : initialNodeList) {
+                NodeModel kubernetesNodeCopy = kubernetesNodeSource.clone();
+                String nodeName = kubernetesNodeCopy.getHostname();   // 节点名称
+                int maxParallelism = kubernetesNodeCopy.getParallelism();
+                String restParallelismString = stringRedisTemplate.opsForValue().get("gpu-node:" + nodeName + ":parallelism");// 获取节点剩余并行度的 key
+                // -------------------------------- Comment --------------------------------
+                int restParallelism;
+                if (restParallelismString == null || Integer.parseInt(restParallelismString) > maxParallelism) {    // 如果剩余可用并行度没有值,说明是第一次查询,则重置成最大并行度的预设值
+                    restParallelism = maxParallelism;
+                    stringRedisTemplate.opsForValue().set("gpu-node:" + nodeName + ":parallelism", String.valueOf(restParallelism));
+                } else {
+                    restParallelism = Integer.parseInt(restParallelismString);
+                    kubernetesNodeCopy.setParallelism(restParallelism);
+                }
+                if (restParallelism > 0) {
+                    restNodeList.add(kubernetesNodeCopy);
+                }
             }
-            if (restParallelism > 0) {
-                restNodeList.add(kubernetesNodeCopy);
+            log.info("剩余并行度的节点列表为:" + restNodeList);
+            Map<String, Integer> resultNodeMap = new HashMap<>();    // 用于执行的节点映射(节点名,并行度)
+            if (!CollectionUtil.isEmpty(restNodeList)) {
+                if (restNodeList.size() == 1) {
+                    NodeModel tempNode = restNodeList.get(0);
+                    String tempNodeName = tempNode.getHostname();
+                    int tempParallelism = tempNode.getParallelism();
+                    resultNodeMap.put(tempNodeName, Math.min(tempParallelism, parallelism));
+                }
+                if (restNodeList.size() > 1) {
+                    for (int i = 0; i < parallelism; i++) {
+                        // 每次降序排序都取剩余并行度最大的一个。
+                        restNodeList.sort((o1, o2) -> o2.getParallelism() - o1.getParallelism());
+                        NodeModel tempNode = restNodeList.get(0);
+                        String tempNodeName = tempNode.getHostname();
+                        int tempParallelism = tempNode.getParallelism();
+                        if (tempParallelism > 0) {
+                            tempNode.setParallelism(tempParallelism - 1);
+                            CollectionUtil.addValueToMap(resultNodeMap, 1, tempNodeName);
+                        }
+                    }
+                }
+            }
+            log.info("即将使用节点的并行度为:" + resultNodeMap);
+            return resultNodeMap;
+        } else if (DictConstants.USE_CPU.equals(isChoiceGpu)) {
+            initialNodeList = kubernetesConfiguration.getCpuNodeList();
+            log.info("预设并行度的节点列表为:" + initialNodeList);
+            // 遍历所有节点,获取还有剩余并行度的节点
+            List<NodeModel> restNodeList = new ArrayList<>();    // 剩余并行度的节点列表
+            for (NodeModel kubernetesNodeSource : initialNodeList) {
+                NodeModel kubernetesNodeCopy = kubernetesNodeSource.clone();
+                String nodeName = kubernetesNodeCopy.getHostname();   // 节点名称
+                int maxParallelism = kubernetesNodeCopy.getParallelism();
+                String restParallelismString = stringRedisTemplate.opsForValue().get("cpu-node:" + nodeName + ":parallelism");// 获取节点剩余并行度的 key
+                // -------------------------------- Comment --------------------------------
+                int restParallelism;
+                if (restParallelismString == null || Integer.parseInt(restParallelismString) > maxParallelism) {    // 如果剩余可用并行度没有值,说明是第一次查询,则重置成最大并行度的预设值
+                    restParallelism = maxParallelism;
+                    stringRedisTemplate.opsForValue().set("cpu-node:" + nodeName + ":parallelism", String.valueOf(restParallelism));
+                } else {
+                    restParallelism = Integer.parseInt(restParallelismString);
+                    kubernetesNodeCopy.setParallelism(restParallelism);
+                }
+                if (restParallelism > 0) {
+                    restNodeList.add(kubernetesNodeCopy);
+                }
             }
+            log.info("剩余并行度的节点列表为:" + restNodeList);
+            Map<String, Integer> resultNodeMap = new HashMap<>();    // 用于执行的节点映射(节点名,并行度)
+            if (!CollectionUtil.isEmpty(restNodeList)) {
+                if (restNodeList.size() == 1) {
+                    NodeModel tempNode = restNodeList.get(0);
+                    String tempNodeName = tempNode.getHostname();
+                    int tempParallelism = tempNode.getParallelism();
+                    resultNodeMap.put(tempNodeName, Math.min(tempParallelism, parallelism));
+                }
+                if (restNodeList.size() > 1) {
+                    for (int i = 0; i < parallelism; i++) {
+                        // 每次降序排序都取剩余并行度最大的一个。
+                        restNodeList.sort((o1, o2) -> o2.getParallelism() - o1.getParallelism());
+                        NodeModel tempNode = restNodeList.get(0);
+                        String tempNodeName = tempNode.getHostname();
+                        int tempParallelism = tempNode.getParallelism();
+                        if (tempParallelism > 0) {
+                            tempNode.setParallelism(tempParallelism - 1);
+                            CollectionUtil.addValueToMap(resultNodeMap, 1, tempNodeName);
+                        }
+                    }
+                }
+            }
+            log.info("即将使用节点的并行度为:" + resultNodeMap);
+            return resultNodeMap;
+        } else {
+            throw new RuntimeException("未知是否使用 GPU:" + isChoiceGpu);
         }
-        log.info(" 集群剩余并行度为:" + restNodeList);
-        return restNodeList.size() == 0 ? 0 : restNodeList.stream().mapToInt(NodeModel::getParallelism).sum();
+
     }
 
     /**
-     * 根据并行度获取用于执行的节点列表
-     * 根据剩余可用并行度降序排序
+     * 获取集群剩余并行度
      *
-     * @return 节点映射(节点名,并行度)
+     * @return 集群剩余并行度
      */
-    public Map<String, Integer> getNodeMapToUse(int parallelism) {
+    public int getRestParallelism() {
         List<NodeModel> initialNodeList = kubernetesConfiguration.getNodeList(); // 预设并行度的节点列表
-        log.info("预设并行度的节点列表为:" + initialNodeList);
         // 遍历所有节点,获取还有剩余并行度的节点
         List<NodeModel> restNodeList = new ArrayList<>();    // 剩余并行度的节点列表
         for (NodeModel kubernetesNodeSource : initialNodeList) {
@@ -321,31 +419,8 @@ public class ProjectUtil {
                 restNodeList.add(kubernetesNodeCopy);
             }
         }
-        log.info("剩余并行度的节点列表为:" + restNodeList);
-        Map<String, Integer> resultNodeMap = new HashMap<>();    // 用于执行的节点映射(节点名,并行度)
-        if (!CollectionUtil.isEmpty(restNodeList)) {
-            if (restNodeList.size() == 1) {
-                NodeModel tempNode = restNodeList.get(0);
-                String tempNodeName = tempNode.getHostname();
-                int tempParallelism = tempNode.getParallelism();
-                resultNodeMap.put(tempNodeName, Math.min(tempParallelism, parallelism));
-            }
-            if (restNodeList.size() > 1) {
-                for (int i = 0; i < parallelism; i++) {
-                    // 每次降序排序都取剩余并行度最大的一个。
-                    restNodeList.sort((o1, o2) -> o2.getParallelism() - o1.getParallelism());
-                    NodeModel tempNode = restNodeList.get(0);
-                    String tempNodeName = tempNode.getHostname();
-                    int tempParallelism = tempNode.getParallelism();
-                    if (tempParallelism > 0) {
-                        tempNode.setParallelism(tempParallelism - 1);
-                        CollectionUtil.addValueToMap(resultNodeMap, 1, tempNodeName);
-                    }
-                }
-            }
-        }
-        log.info("即将使用节点的并行度为:" + resultNodeMap);
-        return resultNodeMap;
+        log.info(" 集群剩余并行度为:" + restNodeList);
+        return restNodeList.size() == 0 ? 0 : restNodeList.stream().mapToInt(NodeModel::getParallelism).sum();
     }
 
 
@@ -567,4 +642,14 @@ public class ProjectUtil {
             throw new RuntimeException("未知项目类型:" + projectType);
         }
     }
+
+    public String getUserIdByProjectIdAndProjectType(String projectId, String projectType) {
+        if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
+            return manualProjectMapper.selectCreateUserById(projectId);
+        } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
+            return autoSubProjectMapper.selectCreateUserById(projectId);
+        } else {
+            throw new RuntimeException("未知项目类型:" + projectType);
+        }
+    }
 }

+ 37 - 36
simulation-resource-server/src/main/java/com/css/simulation/resource/project/service/impl/SimulationProjectServiceImpl.java

@@ -275,7 +275,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
             if (DictConstants.PROJECT_COMPLETED.equals(po.getNowRunState())) {  //3 已经完成的项目再次运行
                 //1 查询项目详情信息并保存,固定项目最原始的运行数据
-                po.setDetails(JsonUtil.beanToJson(selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(po.getId()).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo()));
+                po.setDetails(JsonUtil.beanToJson(selectProjectDetailsByIdBeforeRunning(SimulationManualProjectParam.builder().id(po.getId()).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo()));
                 //2 初始化数据
                 po.setNowRunState(param.getNowRunState());
                 po.setEvaluationLevel("");
@@ -290,7 +290,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             } else { //4 创建新的项目或者重新运行被终止的项目
                 // 查询项目详情信息并保存
                 String projectId = param.getId();
-                ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
+                ProjectDetailsVo info = selectProjectDetailsByIdBeforeRunning(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
                 String infoJson = JsonUtil.beanToJson(info);
                 log.info("项目 " + projectId + " 的详情信息为:" + infoJson);
                 // 保存项目详情信息
@@ -477,7 +477,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, projectDetailsVo);
     }
 
-    private ResponseBodyVO<ProjectDetailsVo> selectProjectDetailsByIdBackUp(SimulationManualProjectParam param) {
+    @SneakyThrows
+    private ResponseBodyVO<ProjectDetailsVo> selectProjectDetailsByIdBeforeRunning(SimulationManualProjectParam param) {
 
         if (isEmpty(param.getId())) {
             return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
@@ -600,35 +601,35 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             }
         }
 
-        // 任务信息
-        ProjectTaskParam projectTaskParam = new ProjectTaskParam();
-        projectTaskParam.setPId(poParam.getId());
-        List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVos = null;
-
-        // 任务运行状态统计
-        List<ProjectRunStateNumVo> projectRunStateNumVos = null;
-
-        // 任务运行结果统计
-        List<ProjectRunResultRatioNumVo> resultScoreList = null;
-
-        Integer size = simulationProjectTaskMapper.selectProjectTaskNumByProjectId(projectTaskParam);
-        if (size > 0) {
-            projectRunStateNumVos = simulationProjectTaskMapper.selectRunStateCount(poParam.getId());
-            taskRunState(projectRunStateNumVos, size);
-
-            projectRunResultRatioNumVos = simulationProjectTaskMapper.selectRunResultCount(poParam.getId());
-            taskResultState(projectRunResultRatioNumVos, size);
-
-            resultScoreList = simulationProjectTaskMapper.selectScoreCount(poParam.getId());
-
-            // 未完成得分为”“的改为0
-            if (!isEmpty(resultScoreList) && resultScoreList.size() == 1 && isEmpty(resultScoreList.get(0).getResultName())) {
-                ProjectRunResultRatioNumVo projectRunResultRatioNumVo = resultScoreList.get(0);
-                projectRunResultRatioNumVo.setResultName("0");
-            }
-            taskScore(resultScoreList, size);
-
-        }
+//        // 任务信息
+//        ProjectTaskParam projectTaskParam = new ProjectTaskParam();
+//        projectTaskParam.setPId(poParam.getId());
+//        List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVos = null;
+//
+//        // 任务运行状态统计
+//        List<ProjectRunStateNumVo> projectRunStateNumVos = null;
+//
+//        // 任务运行结果统计
+//        List<ProjectRunResultRatioNumVo> resultScoreList = null;
+
+//        Integer size = simulationProjectTaskMapper.selectProjectTaskNumByProjectId(projectTaskParam);
+//        if (size > 0) {
+//            projectRunStateNumVos = simulationProjectTaskMapper.selectRunStateCount(poParam.getId());
+//            taskRunState(projectRunStateNumVos, size);
+//
+//            projectRunResultRatioNumVos = simulationProjectTaskMapper.selectRunResultCount(poParam.getId());
+//            taskResultState(projectRunResultRatioNumVos, size);
+//
+//            resultScoreList = simulationProjectTaskMapper.selectScoreCount(poParam.getId());
+//
+//            // 未完成得分为”“的改为0
+//            if (!isEmpty(resultScoreList) && resultScoreList.size() == 1 && isEmpty(resultScoreList.get(0).getResultName())) {
+//                ProjectRunResultRatioNumVo projectRunResultRatioNumVo = resultScoreList.get(0);
+//                projectRunResultRatioNumVo.setResultName("0");
+//            }
+//            taskScore(resultScoreList, size);
+//
+//        }
 
         projectDetailsVo.setProjectId(poParam.getProjectId());
         projectDetailsVo.setProjectName(poParam.getProjectName());
@@ -654,9 +655,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         projectDetailsVo.setSensorLidarList(sensorLidarList);
         projectDetailsVo.setSensorRadarList(sensorRadarList);
         projectDetailsVo.setSensorGpsList(sensorGpsList);
-        projectDetailsVo.setStateList(projectRunStateNumVos);
-        projectDetailsVo.setResultList(projectRunResultRatioNumVos);
-        projectDetailsVo.setResultScoreList(resultScoreList);
+//        projectDetailsVo.setStateList(projectRunStateNumVos);
+//        projectDetailsVo.setResultList(projectRunResultRatioNumVos);
+//        projectDetailsVo.setResultScoreList(resultScoreList);
 
         projectDetailsVo.setParallelism(poParam.getParallelism());
         projectDetailsVo.setMaxSimulationTime(poParam.getMaxSimulationTime());
@@ -4660,7 +4661,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         int i = simulationAutomaticSubProjectMapper.addAutomaticSubProject(subprojectPo);
         // 查询详情信息并保存
         String projectId = subprojectPo.getId();
-        ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_AUTO_SUB).build()).getInfo();
+        ProjectDetailsVo info = selectProjectDetailsByIdBeforeRunning(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_AUTO_SUB).build()).getInfo();
         String infoJson = JsonUtil.beanToJson(info);
         log.info("项目 " + projectId + " 的详情信息为:" + infoJson);
         autoSubProjectMapper.updateDetailsById(projectId, infoJson);

+ 2 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/controller/SceneAccidentController.java → simulation-resource-server/src/main/java/com/css/simulation/resource/scene/controller/scene/SceneAccidentController.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scene.controller;
+package com.css.simulation.resource.scene.controller.scene;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.constants.DictConstants;
@@ -103,4 +103,4 @@ public class SceneAccidentController {
     }
 
 
-}
+}

+ 2 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/controller/SceneGeneralTemplateController.java → simulation-resource-server/src/main/java/com/css/simulation/resource/scene/controller/scene/SceneGeneralTemplateController.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scene.controller;
+package com.css.simulation.resource.scene.controller.scene;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.constants.DictConstants;
@@ -282,4 +282,4 @@ public class SceneGeneralTemplateController {
     }
 
 
-}
+}

+ 2 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/controller/SceneNaturalController.java → simulation-resource-server/src/main/java/com/css/simulation/resource/scene/controller/scene/SceneNaturalController.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scene.controller;
+package com.css.simulation.resource.scene.controller.scene;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.constants.DictConstants;
@@ -99,4 +99,4 @@ public class SceneNaturalController {
         sceneNaturalService.instShareSceneNatural(po);
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
-}
+}

+ 4 - 6
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/controller/StandardsRegulationsController.java → simulation-resource-server/src/main/java/com/css/simulation/resource/scene/controller/scene/SceneStandardsRegulationsController.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scene.controller;
+package com.css.simulation.resource.scene.controller.scene;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.constants.DictConstants;
@@ -25,7 +25,7 @@ import java.util.List;
 //标准法规
 @RestController
 @RequestMapping("/StandardsRegulations")
-public class StandardsRegulationsController {
+public class SceneStandardsRegulationsController {
 
     @Resource
     private StandardsRegulationsService standardsRegulationsService;
@@ -34,7 +34,7 @@ public class StandardsRegulationsController {
 
     @PostMapping("/batchDeleteSceneStandards")
     public ResponseBodyVO<String> batchDeleteSceneStandards(@RequestBody StandardsRegulationsParam params) {
-       List<String> sceneNameList = params.getSceneNameList();
+        List<String> sceneNameList = params.getSceneNameList();
         standardsRegulationsService.batchDeleteSceneStandards(sceneNameList);
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
@@ -59,8 +59,6 @@ public class StandardsRegulationsController {
 
     /**
      * 新增标准法规
-     * @param params
-     * @return
      */
     @PostMapping("/saveStandardsRegulations")
     public ResponseBodyVO<String> saveStandardsRegulations(@RequestBody StandardsRegulationsParam params) {
@@ -114,4 +112,4 @@ public class StandardsRegulationsController {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
 
-}
+}