LingxinMeng 1 年之前
父節點
當前提交
79cf6fd2e4

+ 17 - 17
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/app/service/ProjectApplicationService.java

@@ -155,12 +155,12 @@ public class ProjectApplicationService {
             log.info("项目 " + projectId + " 算法已导入:" + algorithmDockerImage);
             log.info("项目 " + projectId + " 算法已导入:" + algorithmDockerImage);
             customRedisClient.set("project:" + projectId + ":docker-image", algorithmDockerImage);
             customRedisClient.set("project:" + projectId + ":docker-image", algorithmDockerImage);
             // -------------------------------- 3 查询模型 --------------------------------
             // -------------------------------- 3 查询模型 --------------------------------
-            log.debug("项目 " + projectId + " 开始查询模型。");
+            log.info("项目 " + projectId + " 开始查询模型。");
             //1 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
             //1 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
             com.css.simulation.resource.scheduler.infra.entity.VehicleEntity vehicleEntity = vehicleMapper.selectByVehicleConfigId(vehicleConfigId);   // 车辆
             com.css.simulation.resource.scheduler.infra.entity.VehicleEntity vehicleEntity = vehicleMapper.selectByVehicleConfigId(vehicleConfigId);   // 车辆
             List<CameraEntity> cameraEntityList = sensorCameraMapper.selectCameraByVehicleConfigId(vehicleConfigId);    // 摄像头
             List<CameraEntity> cameraEntityList = sensorCameraMapper.selectCameraByVehicleConfigId(vehicleConfigId);    // 摄像头
             List<OgtEntity> ogtEntityList = sensorOgtMapper.selectOgtByVehicleId(vehicleConfigId); // 完美传感器
             List<OgtEntity> ogtEntityList = sensorOgtMapper.selectOgtByVehicleId(vehicleConfigId); // 完美传感器
-            log.debug("项目 " + projectId + " 开始保存任务消息。");
+            log.info("项目 " + projectId + " 开始保存任务消息。");
             if (DictConstants.MODEL_TYPE_VTD.equals(modelType)) {
             if (DictConstants.MODEL_TYPE_VTD.equals(modelType)) {
                 // -------------------------------- 4 保存任务消息 --------------------------------
                 // -------------------------------- 4 保存任务消息 --------------------------------
                 List<TaskEntity> taskList = new ArrayList<>();
                 List<TaskEntity> taskList = new ArrayList<>();
@@ -226,7 +226,7 @@ public class ProjectApplicationService {
                         TaskMessageEntity taskMessageEntity = TaskMessageEntity.builder().info(InfoEntity.builder().project_id(taskEntity.getPId()).task_id(taskEntity.getId()).task_path(taskEntity.getRunResultFilePath()).default_time(videoTime).build()).scenario(ScenarioEntity.builder().scenario_osc(xoscPathOfMinio).scenario_odr(xodrPathOfMinio).scenario_osgb(osgbPathOfMinio).build()).vehicle(VehicleEntity.builder().model(ModelEntity.builder().model_label(vehicleEntity.getModelLabel()).build()).dynamics(DynamicsEntity.builder().dynamics_maxspeed(vehicleEntity.getMaxSpeed()).dynamics_enginepower(vehicleEntity.getEnginePower()).dynamics_maxdecel(vehicleEntity.getMaxDeceleration()).dynamics_maxsteering(vehicleEntity.getMaxSteeringAngle()).dynamics_mass(vehicleEntity.getMass()).dynamics_frontsurfaceeffective(vehicleEntity.getFrontSurfaceEffective()).dynamics_airdragcoefficient(vehicleEntity.getAirDragCoefficient()).dynamics_rollingresistance(vehicleEntity.getRollingResistanceCoefficient()).dynamics_wheeldiameter(vehicleEntity.getWheelDiameter()).dynamics_wheeldrive(vehicleEntity.getWheelDrive()).dynamics_overallefficiency(vehicleEntity.getOverallEfficiency()).dynamics_distfront(vehicleEntity.getFrontDistance()).dynamics_distrear(vehicleEntity.getRearDistance()).dynamics_distleft(vehicleEntity.getLeftDistance()).dynamics_distright(vehicleEntity.getRightDistance()).dynamics_distheight(vehicleEntity.getHeightDistance()).dynamics_wheelbase(vehicleEntity.getWheelbase()).build()).sensors(SensorsEntity.builder()   // 根据 vehicleId 查询绑定的传感器列表
                         TaskMessageEntity taskMessageEntity = TaskMessageEntity.builder().info(InfoEntity.builder().project_id(taskEntity.getPId()).task_id(taskEntity.getId()).task_path(taskEntity.getRunResultFilePath()).default_time(videoTime).build()).scenario(ScenarioEntity.builder().scenario_osc(xoscPathOfMinio).scenario_odr(xodrPathOfMinio).scenario_osgb(osgbPathOfMinio).build()).vehicle(VehicleEntity.builder().model(ModelEntity.builder().model_label(vehicleEntity.getModelLabel()).build()).dynamics(DynamicsEntity.builder().dynamics_maxspeed(vehicleEntity.getMaxSpeed()).dynamics_enginepower(vehicleEntity.getEnginePower()).dynamics_maxdecel(vehicleEntity.getMaxDeceleration()).dynamics_maxsteering(vehicleEntity.getMaxSteeringAngle()).dynamics_mass(vehicleEntity.getMass()).dynamics_frontsurfaceeffective(vehicleEntity.getFrontSurfaceEffective()).dynamics_airdragcoefficient(vehicleEntity.getAirDragCoefficient()).dynamics_rollingresistance(vehicleEntity.getRollingResistanceCoefficient()).dynamics_wheeldiameter(vehicleEntity.getWheelDiameter()).dynamics_wheeldrive(vehicleEntity.getWheelDrive()).dynamics_overallefficiency(vehicleEntity.getOverallEfficiency()).dynamics_distfront(vehicleEntity.getFrontDistance()).dynamics_distrear(vehicleEntity.getRearDistance()).dynamics_distleft(vehicleEntity.getLeftDistance()).dynamics_distright(vehicleEntity.getRightDistance()).dynamics_distheight(vehicleEntity.getHeightDistance()).dynamics_wheelbase(vehicleEntity.getWheelbase()).build()).sensors(SensorsEntity.builder()   // 根据 vehicleId 查询绑定的传感器列表
                                 .camera(cameraEntityList).OGT(ogtEntityList).build()).build()).build();
                                 .camera(cameraEntityList).OGT(ogtEntityList).build()).build()).build();
                         FileUtil.writeStringToLocalFile(JsonUtil.beanToJson(taskMessageEntity), projectPath + taskId + ".json");
                         FileUtil.writeStringToLocalFile(JsonUtil.beanToJson(taskMessageEntity), projectPath + taskId + ".json");
-                        log.debug("项目 " + projectId + " 将任务消息转成 json 保存到临时目录等待资源分配后执行:" + taskMessageEntity.getInfo().getTask_id());
+                        log.info("项目 " + projectId + " 将任务消息转成 json 保存到临时目录等待资源分配后执行:" + taskMessageEntity.getInfo().getTask_id());
                     }
                     }
                 }
                 }
                 taskDomainService.batchInsertTask(taskList);
                 taskDomainService.batchInsertTask(taskList);
@@ -296,7 +296,7 @@ public class ProjectApplicationService {
                                 .camera(cameraEntityList).OGT(ogtEntityList).build()).build()).build();
                                 .camera(cameraEntityList).OGT(ogtEntityList).build()).build()).build();
 
 
                         FileUtil.writeStringToLocalFile(JsonUtil.beanToJson(taskMessageEntity), projectPath + taskId + ".json");
                         FileUtil.writeStringToLocalFile(JsonUtil.beanToJson(taskMessageEntity), projectPath + taskId + ".json");
-                        log.debug("项目 " + projectId + " 将任务消息转成 json 保存到临时目录等待资源分配后执行:" + taskMessageEntity.getInfo().getTask_id());
+                        log.info("项目 " + projectId + " 将任务消息转成 json 保存到临时目录等待资源分配后执行:" + taskMessageEntity.getInfo().getTask_id());
                     }
                     }
                 }
                 }
                 taskDomainService.batchInsertTask(taskList);
                 taskDomainService.batchInsertTask(taskList);
@@ -321,7 +321,7 @@ public class ProjectApplicationService {
         final String waitingType = projectWaitQueueEntity.getWaitingType();
         final String waitingType = projectWaitQueueEntity.getWaitingType();
         final Integer waitingParallelism = projectWaitQueueEntity.getWaitingParallelism();
         final Integer waitingParallelism = projectWaitQueueEntity.getWaitingParallelism();
         final ProjectStartMessageEntity projectStartMessageEntity = projectWaitQueueEntity.getProjectStartMessageEntity();
         final ProjectStartMessageEntity projectStartMessageEntity = projectWaitQueueEntity.getProjectStartMessageEntity();
-        log.debug("判断用户是否拥有可分配资源:" + projectStartMessageEntity);
+        log.info("判断用户是否拥有可分配资源:" + projectStartMessageEntity);
         //1 项目信息
         //1 项目信息
         String modelType = projectStartMessageEntity.getModelType();
         String modelType = projectStartMessageEntity.getModelType();
         String projectId = projectStartMessageEntity.getProjectId();    // 手动执行项目 id 或 自动执行子项目 id
         String projectId = projectStartMessageEntity.getProjectId();    // 手动执行项目 id 或 自动执行子项目 id
@@ -339,7 +339,7 @@ public class ProjectApplicationService {
         String clusterUserId;  // 项目实际运行使用的用户集群
         String clusterUserId;  // 项目实际运行使用的用户集群
         if (DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode) || DictConstants.ROLE_CODE_ADMIN.equals(roleCode)) {  //3-1 管理员账户和管理员子账户直接执行
         if (DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode) || DictConstants.ROLE_CODE_ADMIN.equals(roleCode)) {  //3-1 管理员账户和管理员子账户直接执行
             clusterUserId = DictConstants.SYSTEM_USER_ID;
             clusterUserId = DictConstants.SYSTEM_USER_ID;
-            log.debug("项目 " + projectId + " 的创建人 " + projectUserId + " 为管理员账户或管理员子账户,直接判断服务器能否执行。");
+            log.info("项目 " + projectId + " 的创建人 " + projectUserId + " 为管理员账户或管理员子账户,直接判断服务器能否执行。");
             PrefixEntity redisPrefix = projectDomainService.getRedisPrefixByClusterIdAndProjectId(DictConstants.SYSTEM_CLUSTER_ID, projectId);
             PrefixEntity redisPrefix = projectDomainService.getRedisPrefixByClusterIdAndProjectId(DictConstants.SYSTEM_CLUSTER_ID, projectId);
             final String projectRunningKey = redisPrefix.getProjectRunningKey();
             final String projectRunningKey = redisPrefix.getProjectRunningKey();
             if (remainderParallelism <= 0) {
             if (remainderParallelism <= 0) {
@@ -354,16 +354,16 @@ public class ProjectApplicationService {
         } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) { //3-2 普通账户,不管是独占还是共享,都在自己的集群里排队,根据自己的独占节点排队
         } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) { //3-2 普通账户,不管是独占还是共享,都在自己的集群里排队,根据自己的独占节点排队
             clusterUserId = projectUserId;
             clusterUserId = projectUserId;
             clusterEntity = clusterMapper.selectByUserId(clusterUserId);
             clusterEntity = clusterMapper.selectByUserId(clusterUserId);
-            log.debug("项目 " + projectId + " 的创建人 " + projectUserId + " 为普通账户(包括独占或共享都在自己的集群),集群为:" + clusterEntity);
+            log.info("项目 " + projectId + " 的创建人 " + projectUserId + " 为普通账户(包括独占或共享都在自己的集群),集群为:" + clusterEntity);
         } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
         } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
             if (DictConstants.USER_TYPE_EXCLUSIVE.equals(useType)) {   //3-3 普通子账户,根据自己的独占节点排队
             if (DictConstants.USER_TYPE_EXCLUSIVE.equals(useType)) {   //3-3 普通子账户,根据自己的独占节点排队
                 clusterUserId = projectUserId;
                 clusterUserId = projectUserId;
                 clusterEntity = clusterMapper.selectByUserId(clusterUserId);
                 clusterEntity = clusterMapper.selectByUserId(clusterUserId);
-                log.debug("项目 " + projectId + " 的创建人 " + projectUserId + " 为普通独占子账户(自己的集群),集群为:" + clusterEntity);
+                log.info("项目 " + projectId + " 的创建人 " + projectUserId + " 为普通独占子账户(自己的集群),集群为:" + clusterEntity);
             } else if (DictConstants.USER_TYPE_PUBLIC.equals(useType)) {    //3-4 共享子账户,根据父账户的共享节点排队
             } else if (DictConstants.USER_TYPE_PUBLIC.equals(useType)) {    //3-4 共享子账户,根据父账户的共享节点排队
                 clusterUserId = userEntity.getCreateUserId();
                 clusterUserId = userEntity.getCreateUserId();
                 clusterEntity = clusterMapper.selectByUserId(clusterUserId);
                 clusterEntity = clusterMapper.selectByUserId(clusterUserId);
-                log.debug("项目 " + projectId + " 的创建人 " + projectUserId + " 为普通共享子账户(父账户的集群),集群为:" + clusterEntity);
+                log.info("项目 " + projectId + " 的创建人 " + projectUserId + " 为普通共享子账户(父账户的集群),集群为:" + clusterEntity);
             } else {
             } else {
                 throw new RuntimeException("用户" + projectUserId + "未知占用类型:" + useType);
                 throw new RuntimeException("用户" + projectUserId + "未知占用类型:" + useType);
             }
             }
@@ -409,7 +409,7 @@ public class ProjectApplicationService {
             if (DictConstants.MODEL_TYPE_VTD.equals(modelType)) {
             if (DictConstants.MODEL_TYPE_VTD.equals(modelType)) {
                 int expandParallelism;
                 int expandParallelism;
                 if (remainderSimulationLicense <= 0 || remainderParallelism <= 0) {
                 if (remainderSimulationLicense <= 0 || remainderParallelism <= 0) {
-                    log.debug("无可用证书或并行度。");
+                    log.info("无可用证书或并行度。");
                 } else {
                 } else {
                     if (remainderSimulationLicense < waitingParallelism || remainderParallelism <= waitingParallelism) {
                     if (remainderSimulationLicense < waitingParallelism || remainderParallelism <= waitingParallelism) {
                         expandParallelism = Math.min(remainderSimulationLicense, remainderParallelism);
                         expandParallelism = Math.min(remainderSimulationLicense, remainderParallelism);
@@ -424,7 +424,7 @@ public class ProjectApplicationService {
                 remainderDynamicLicense = numDynamicLicense - usingDynamicLicenseNumber;
                 remainderDynamicLicense = numDynamicLicense - usingDynamicLicenseNumber;
                 int expandParallelism;
                 int expandParallelism;
                 if (remainderSimulationLicense <= 0 || remainderDynamicLicense <= 0 || remainderParallelism <= 0) {
                 if (remainderSimulationLicense <= 0 || remainderDynamicLicense <= 0 || remainderParallelism <= 0) {
-                    log.debug("无可用证书或并行度。");
+                    log.info("无可用证书或并行度。");
                 } else {
                 } else {
                     if (remainderSimulationLicense < waitingParallelism || remainderDynamicLicense < waitingParallelism || remainderParallelism < waitingParallelism) {
                     if (remainderSimulationLicense < waitingParallelism || remainderDynamicLicense < waitingParallelism || remainderParallelism < waitingParallelism) {
                         expandParallelism = Math.min(Math.min(remainderSimulationLicense, remainderDynamicLicense), remainderParallelism);
                         expandParallelism = Math.min(Math.min(remainderSimulationLicense, remainderDynamicLicense), remainderParallelism);
@@ -557,7 +557,7 @@ public class ProjectApplicationService {
                 remainderNodeMap.put(currentNodeName, cpuOrder);
                 remainderNodeMap.put(currentNodeName, cpuOrder);
             }
             }
             // 只有准备启动(即 currentCount == 0)的时候才指定 cpu 编号
             // 只有准备启动(即 currentCount == 0)的时候才指定 cpu 编号
-            log.debug("创建任务 " + taskId + " 的 yaml:是否使用 gpu (0是1否)" + isChoiceGpu + ",当前节点已创建 yaml 个数为:" + currentCount + ",当前节点名称为:" + currentNodeName + ",当前 cpu 编号为:" + cpuOrder + ",镜像名:" + algorithmDockerImage);
+            log.info("创建任务 " + taskId + " 的 yaml:是否使用 gpu (0是1否)" + isChoiceGpu + ",当前节点已创建 yaml 个数为:" + currentCount + ",当前节点名称为:" + currentNodeName + ",当前 cpu 编号为:" + cpuOrder + ",镜像名:" + algorithmDockerImage);
             String yamlRedisKey = projectDomainService.createTempYaml(projectId, vehicleConfigId, modelType, algorithmDockerImage, currentNodeName, partition, offset, isChoiceGpu, cpuOrder);
             String yamlRedisKey = projectDomainService.createTempYaml(projectId, vehicleConfigId, modelType, algorithmDockerImage, currentNodeName, partition, offset, isChoiceGpu, cpuOrder);
             if (currentCount == 0) {
             if (currentCount == 0) {
                 yamlToRunRedisKeyList.add(yamlRedisKey);
                 yamlToRunRedisKeyList.add(yamlRedisKey);
@@ -565,11 +565,11 @@ public class ProjectApplicationService {
             messageNumber++;
             messageNumber++;
         }
         }
         TimeUnit.SECONDS.sleep(3);
         TimeUnit.SECONDS.sleep(3);
-        log.debug("项目 " + projectId + " 共发送了 " + messageNumber + " 条消息,准备首先启动 " + yamlToRunRedisKeyList);
+        log.info("项目 " + projectId + " 共发送了 " + messageNumber + " 条消息,准备首先启动 " + yamlToRunRedisKeyList);
         for (String redisKey : yamlToRunRedisKeyList) {
         for (String redisKey : yamlToRunRedisKeyList) {
             projectDomainService.createPodBegin(projectId, redisKey);
             projectDomainService.createPodBegin(projectId, redisKey);
         }
         }
-        log.debug("项目 " + projectId + " 已经启动 " + yamlToRunRedisKeyList);
+        log.info("项目 " + projectId + " 已经启动 " + yamlToRunRedisKeyList);
         // 项目启动之后删除等待队列中的该项目
         // 项目启动之后删除等待队列中的该项目
         projectDomainService.removeWaitQueue(DictConstants.PROJECT_WAIT_TYPE_EXECUTE, projectId);
         projectDomainService.removeWaitQueue(DictConstants.PROJECT_WAIT_TYPE_EXECUTE, projectId);
 
 
@@ -655,7 +655,7 @@ public class ProjectApplicationService {
         stringRedisTemplate.opsForValue().set(allIndexPrefix, JsonUtil.listToJson(allIndexList));
         stringRedisTemplate.opsForValue().set(allIndexPrefix, JsonUtil.listToJson(allIndexList));
         //2 查询场景包叶子指标
         //2 查询场景包叶子指标
         List<IndexTemplateEntity> leafIndexList = allIndexList.stream().filter(index -> StringUtil.isNotEmpty(index.getRuleId())).collect(Collectors.toList());
         List<IndexTemplateEntity> leafIndexList = allIndexList.stream().filter(index -> StringUtil.isNotEmpty(index.getRuleId())).collect(Collectors.toList());
-        log.debug("项目 " + projectId + " 的叶子指标为:" + leafIndexList);
+        log.info("项目 " + projectId + " 的叶子指标为:" + leafIndexList);
         stringRedisTemplate.opsForValue().set(leafIndexPrefix, JsonUtil.listToJson(leafIndexList));
         stringRedisTemplate.opsForValue().set(leafIndexPrefix, JsonUtil.listToJson(leafIndexList));
         List<SceneEntity> sceneList = new ArrayList<>();
         List<SceneEntity> sceneList = new ArrayList<>();
         leafIndexList.forEach(leafIndex -> {
         leafIndexList.forEach(leafIndex -> {
@@ -700,7 +700,7 @@ public class ProjectApplicationService {
         String algorithmDirectoryLinuxTempPath;
         String algorithmDirectoryLinuxTempPath;
         String algorithmTarLinuxTempPath = null;
         String algorithmTarLinuxTempPath = null;
         if (algorithmEntity != null) {
         if (algorithmEntity != null) {
-            log.debug("项目" + projectId + "使用仿真平台自己的算法 " + algorithmEntity);
+            log.info("项目" + projectId + "使用仿真平台自己的算法 " + algorithmEntity);
             String algorithmCode = algorithmEntity.getAlgorithmCode();
             String algorithmCode = algorithmEntity.getAlgorithmCode();
             String dockerImport = algorithmEntity.getDockerImport();
             String dockerImport = algorithmEntity.getDockerImport();
             dockerImage = dockerConfiguration.getRegistry() + "/algorithm_" + algorithmCode + ":latest";
             dockerImage = dockerConfiguration.getRegistry() + "/algorithm_" + algorithmCode + ":latest";
@@ -735,7 +735,7 @@ public class ProjectApplicationService {
                 OsUtil.exec("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
                 OsUtil.exec("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
                 OsUtil.exec("docker push " + dockerImage);
                 OsUtil.exec("docker push " + dockerImage);
                 FileUtil.rm(algorithmTarLinuxTempPath);
                 FileUtil.rm(algorithmTarLinuxTempPath);
-                log.debug("已删除算法临时文件:" + algorithmTarLinuxTempPath);
+                log.info("已删除算法临时文件:" + algorithmTarLinuxTempPath);
             } else {
             } else {
                 throw new RuntimeException("算法 " + algorithmId + " 的 mysql 数据有误!");
                 throw new RuntimeException("算法 " + algorithmId + " 的 mysql 数据有误!");
             }
             }

+ 39 - 32
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/SimulationProjectServiceImpl.java

@@ -268,6 +268,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         final String oldState = oldProjectPO.getNowRunState();
         final String oldState = oldProjectPO.getNowRunState();
         final String newState = oldProjectParam.getNowRunState();
         final String newState = oldProjectParam.getNowRunState();
         final String oldProjectId = oldProjectParam.getId();
         final String oldProjectId = oldProjectParam.getId();
+        final int parallelism = Integer.parseInt(oldProjectPO.getParallelism());
         //2 查询项目详情信息,固定项目最原始的运行数据
         //2 查询项目详情信息,固定项目最原始的运行数据
         ProjectDetailsVO projectDetailsVO = selectProjectDetailsByIdBeforeRunning(SimulationManualProjectParam.builder().id(oldProjectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
         ProjectDetailsVO projectDetailsVO = selectProjectDetailsByIdBeforeRunning(SimulationManualProjectParam.builder().id(oldProjectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
         projectDetailsVO.setFinishTime("");
         projectDetailsVO.setFinishTime("");
@@ -285,7 +286,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             projectDetailsVO.setNowRunState(DictConstants.PROJECT_RUNNING);
             projectDetailsVO.setNowRunState(DictConstants.PROJECT_RUNNING);
             projectDetailsVO.setNowRunStateName(DictConstants.PROJECT_RUNNING_NAME);
             projectDetailsVO.setNowRunStateName(DictConstants.PROJECT_RUNNING_NAME);
             //1 校验项目的信息是否可用
             //1 校验项目的信息是否可用
-            projectUtil.checkProject(oldProjectPO.getAlgorithm(), oldProjectPO.getVehicle(), oldProjectPO.getScene());
+            projectUtil.checkProject(oldProjectPO.getAlgorithm(), oldProjectPO.getVehicle(), oldProjectPO.getScene(), parallelism);
             if (DictConstants.PROJECT_COMPLETED.equals(oldState)) {  // 根据已完成的项目创建新项目
             if (DictConstants.PROJECT_COMPLETED.equals(oldState)) {  // 根据已完成的项目创建新项目
                 SimulationManualProjectPO newProjectPO = new SimulationManualProjectPO();
                 SimulationManualProjectPO newProjectPO = new SimulationManualProjectPO();
                 BeanUtils.copyProperties(oldProjectPO, newProjectPO);
                 BeanUtils.copyProperties(oldProjectPO, newProjectPO);
@@ -1558,43 +1559,47 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
      */
      */
     private List<DropDownVo> getOtherAlgorithmInfo(String query) {
     private List<DropDownVo> getOtherAlgorithmInfo(String query) {
 
 
-        //1 判断用户是否是管理员
-        final boolean admin = userDomainService.isAdmin(AuthUtil.getCurrentUserId(), AuthUtil.getCurrentUserRoleCode());
-
-        List<DropDownVo> algorithmList = new ArrayList<>();
-
-        ResponseBodyVO<String> algorithmBody = algoPlatformService.getAlgorithmList(query);
-
-        // 解析数据
-        Map jsonMap = JsonUtil.jsonToMap(algorithmBody.getInfo());
-        Map<String, Object> dataMap = (Map<String, Object>) jsonMap.get("data");
-        List<Map<String, String>> contentList = (List<Map<String, String>>) dataMap.get("content");
-        Integer totalElements = (Integer) dataMap.get("totalElements");
-        if (totalElements > 0) {
-            for (Map<String, String> content : contentList) {
-                final String teamName = content.get("teamName");
-                final String algorithmId = content.get("algorithmId");
-                final String algorithmName = content.get("algorithmName");
-                final String evaluationName = content.get("evaluationName");    // 算法版本号
-                final String description = content.get("description");
-                if (StringUtil.isNotEmpty(teamName)) {
-                    if (admin) {
+        try {
+            //1 判断用户是否是管理员
+            final boolean admin = userDomainService.isAdmin(AuthUtil.getCurrentUserId(), AuthUtil.getCurrentUserRoleCode());
+
+            List<DropDownVo> algorithmList = new ArrayList<>();
+
+            ResponseBodyVO<String> algorithmBody = algoPlatformService.getAlgorithmList(query);
+
+            // 解析数据
+            Map jsonMap = JsonUtil.jsonToMap(algorithmBody.getInfo());
+            Map<String, Object> dataMap = (Map<String, Object>) jsonMap.get("data");
+            List<Map<String, String>> contentList = (List<Map<String, String>>) dataMap.get("content");
+            Integer totalElements = (Integer) dataMap.get("totalElements");
+            if (totalElements > 0) {
+                for (Map<String, String> content : contentList) {
+                    final String teamName = content.get("teamName");
+                    final String algorithmId = content.get("algorithmId");
+                    final String algorithmName = content.get("algorithmName");
+                    final String evaluationName = content.get("evaluationName");    // 算法版本号
+                    final String description = content.get("description");
+                    if (StringUtil.isNotEmpty(teamName)) {
+                        if (admin) {
+                            DropDownVo dropDownVo = new DropDownVo();
+                            dropDownVo.setId(algorithmId);
+                            dropDownVo.setName(algorithmName + "-" + evaluationName);
+                            dropDownVo.setDescription(description);
+                            algorithmList.add(dropDownVo);
+                        }
+                    } else {
                         DropDownVo dropDownVo = new DropDownVo();
                         DropDownVo dropDownVo = new DropDownVo();
                         dropDownVo.setId(algorithmId);
                         dropDownVo.setId(algorithmId);
-                        dropDownVo.setName(algorithmName + "-" + evaluationName);
+                        dropDownVo.setName(algorithmName);
                         dropDownVo.setDescription(description);
                         dropDownVo.setDescription(description);
                         algorithmList.add(dropDownVo);
                         algorithmList.add(dropDownVo);
                     }
                     }
-                } else {
-                    DropDownVo dropDownVo = new DropDownVo();
-                    dropDownVo.setId(algorithmId);
-                    dropDownVo.setName(algorithmName);
-                    dropDownVo.setDescription(description);
-                    algorithmList.add(dropDownVo);
                 }
                 }
             }
             }
+            return algorithmList;
+        } catch (Exception e) {
+            throw new RuntimeException("第三方算法已被删除。");
         }
         }
-        return algorithmList;
 
 
     }
     }
 
 
@@ -4654,9 +4659,10 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
 
         // 1 修改父项目停用状态
         // 1 修改父项目停用状态
         SimulationAutomaticProjectPO po = simulationAutomaticProjectMapper.selectById(id); // 查询父项目信息
         SimulationAutomaticProjectPO po = simulationAutomaticProjectMapper.selectById(id); // 查询父项目信息
+        final int parallelism = Integer.parseInt(po.getParallelism());
         if ("0".equals(param.getAutomaticRunState())) { // 启动
         if ("0".equals(param.getAutomaticRunState())) { // 启动
             // 1 判断算法是否已经被删除
             // 1 判断算法是否已经被删除
-            projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
+            projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene(), parallelism);
             String currentGitVersion = algorithmService.getGitVersion(po.getAlgorithm());
             String currentGitVersion = algorithmService.getGitVersion(po.getAlgorithm());
             simulationAutomaticProjectMapper.updateAutomaticRunState(param);
             simulationAutomaticProjectMapper.updateAutomaticRunState(param);
             AlgorithmParameter algorithmParam = new AlgorithmParameter();
             AlgorithmParameter algorithmParam = new AlgorithmParameter();
@@ -4728,7 +4734,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         }
         }
         SimulationAutomaticProjectPO po = simulationAutomaticProjectMapper.selectById(param.getId());
         SimulationAutomaticProjectPO po = simulationAutomaticProjectMapper.selectById(param.getId());
         // 校验项目信息
         // 校验项目信息
-        projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
+        int parallelism = Integer.parseInt(po.getParallelism());
+        projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene(), parallelism);
         // 组装数据
         // 组装数据
         String projectName = po.getProjectName();
         String projectName = po.getProjectName();
         SimulationAutomaticSubProjectPO subprojectPo = new SimulationAutomaticSubProjectPO();
         SimulationAutomaticSubProjectPO subprojectPo = new SimulationAutomaticSubProjectPO();

+ 5 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/server/infra/util/ProjectUtil.java

@@ -79,7 +79,7 @@ public class ProjectUtil {
         }
         }
     }
     }
 
 
-    public void checkProject(String algorithmId, String vehicleConfigId, String scenePackageId) {
+    public void checkProject(String algorithmId, String vehicleConfigId, String scenePackageId, int parallelism) {
         //* -------------------------------- Comment --------------------------------
         //* -------------------------------- Comment --------------------------------
         log.info("1 检查算法是否被删除:" + algorithmId);
         log.info("1 检查算法是否被删除:" + algorithmId);
         if (DictConstants.IS_DELETED.equals(algorithmMapper.selectIsDeletedById(algorithmId))) {
         if (DictConstants.IS_DELETED.equals(algorithmMapper.selectIsDeletedById(algorithmId))) {
@@ -118,6 +118,10 @@ public class ProjectUtil {
         if (sceneNum == 0) {
         if (sceneNum == 0) {
             throw new RuntimeException("场景测试包内的场景已被全部删除,请添加场景。");
             throw new RuntimeException("场景测试包内的场景已被全部删除,请添加场景。");
         }
         }
+        log.info("5 判断并行度是否大于场景测试包内场景数量。");
+        if (sceneNum < parallelism) {
+            throw new RuntimeException("并行度 " + parallelism + " 大于场景测试包内场景数量 " + sceneNum + " ,请修改并行度。");
+        }
 
 
     }
     }
 }
 }