LingxinMeng 2 سال پیش
والد
کامیت
6170cb7194

+ 1 - 1
api-common/src/main/java/api/common/util/FileUtil.java

@@ -723,7 +723,7 @@ public class FileUtil {
         File rootFile = new File(rootPath);
         //1 判断文件是否存在
         if (!rootFile.exists()) {
-            throw new RuntimeException("FileUtil.listAbsolutePathByType() 文件 " + rootPath + " 不存在!");
+            throw new RuntimeException("文件 " + rootPath + " 不存在!");
         }
         //2 判断是否是文件
         if (rootFile.isFile() && rootFile.getName().endsWith(type) && rootFile.getName().length() == length) {

+ 1 - 1
api-common/src/main/java/api/common/util/JgitUtil.java

@@ -52,7 +52,7 @@ public class JgitUtil {
         try {
             return Git.lsRemoteRepository().setRemote(remoteUrl).callAsMap();
         } catch (GitAPIException e) {
-            throw new RuntimeException(e);
+            throw new RuntimeException("私有仓库需输入用户名密码,请检查。");
         }
     }
 

+ 1 - 1
simulation-resource-common/src/main/java/com/css/simulation/resource/common/controller/AlgorithmPlatformController.java

@@ -60,7 +60,7 @@ public class AlgorithmPlatformController {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "请求成功!", algorithmName);
     }
 
-    private String getToken() throws Exception {
+    private String getToken() {
         RedisParameter redisParameter = new RedisParameter();
         redisParameter.setKey(TOKEN_KEY);
         ResponseBodyVO<String> responseBodyVO = redisController.get(redisParameter);

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

@@ -30,6 +30,8 @@ public class KubernetesConfiguration {
     private String carsimImage;
     private String carsimCommand;
     private List<GpuNodeEntity> nodeList;
+    private List<GpuNodeEntity> cpuList;
+    private List<GpuNodeEntity> gpuList;
 
     @Bean
     @SneakyThrows

+ 3 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ProjectConsumer.java

@@ -303,9 +303,11 @@ public class ProjectConsumer {
     public void cacheProject(ProjectMessageDTO projectMessageDTO) {
         log.info("判断用户是否拥有可分配资源:" + projectMessageDTO);
         //1 读取 kafka 的 project 信息
+        final String modelType = projectMessageDTO.getModelType();
         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)) {
@@ -404,7 +406,7 @@ public class ProjectConsumer {
         String algorithmId = projectMessageDTO.getAlgorithmId();    // 算法 id
         String projectPath = linuxTempPath + "project/" + projectId + "/";
         // -------------------------------- 1 获取任务 json 列表 --------------------------------
-        List<String> taskJsonList = FileUtil.listAbsolutePathByTypeAndLength(projectPath, "json", 37);
+        List<String> taskJsonList = FileUtil.listAbsolutePathByTypeAndLength(projectPath, "json", (StringUtil.getRandomUUID()+".json").length());
         int taskTotal = taskJsonList.size();
         projectMessageDTO.setTaskTotal(taskTotal);
         projectMessageDTO.setTaskCompleted(0);

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

@@ -478,7 +478,7 @@ public class ProjectUtil {
 
     public void resetNodeParallelism() {
         kubernetesConfiguration.getNodeList().forEach((node) -> customRedisClient.set("gpu-node:" + node.getHostname() + ":parallelism", node.getParallelism() + ""));
-        esminiConfiguration.getNodeList().forEach((node) -> customRedisClient.set("cpu-node:" + node.getHostname() + ":parallelism", node.getParallelism() + ""));
+        esminiConfiguration.getNodeList().forEach((node) -> customRedisClient.set("esmini-node:" + node.getHostname() + ":parallelism", node.getParallelism() + ""));
     }
 
     /**

+ 11 - 6
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/service/impl/AlgorithmServiceImpl.java

@@ -246,13 +246,18 @@ public class AlgorithmServiceImpl implements AlgorithmService {
 
     @Override
     public ResponseBodyVO<String> testConnection(AlgorithmParameter param) {
-        try {
-            JgitUtil.testConnection(param.getGitUrl().replace(gitConfiguration.getName(), gitConfiguration.getUrl()), param.getGitUserName(), param.getGitPassword());
-            return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "连接成功");
-        } catch (Exception e) {
-            log.error(e.getMessage());
-            return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "连接失败!");
+        final String gitUrl = param.getGitUrl().replace(gitConfiguration.getName(), gitConfiguration.getUrl());
+        final String gitUserName = param.getGitUserName();
+        final String gitPassword = param.getGitPassword();
+        if (StringUtil.isEmpty(gitUserName) && StringUtil.isEmpty(gitPassword)) {
+            JgitUtil.testPublicConnection(gitUrl);
+        } else if (StringUtil.isNotEmpty(gitUserName) && StringUtil.isNotEmpty(gitPassword)) {
+            JgitUtil.testPrivateConnection(gitUrl, gitUserName, gitPassword);
+        } else {
+            JgitUtil.testPublicConnection(gitUrl);
+            JgitUtil.testPrivateConnection(gitUrl, gitUserName, gitPassword);
         }
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
 
     @Override

+ 1 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneAccidentService.java

@@ -691,7 +691,7 @@ public class SceneAccidentService {
                 if (filePath.contains("/Scenarios")) {
                     MI.setObjectName(filePath);
                     List<String> listScene = fileDownService.listDeepOne(MI).getInfo();
-                    log.info("importMinio() 共需要上传 " + listScene.size() + " 个交通事故场景");
+                    log.info("共需要上传 " + listScene.size() + " 个交通事故场景");
                     for (String scenePath : listScene) {
                         try {
                             MI.setObjectName(scenePath);

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

@@ -75,10 +75,10 @@ public class VideoService {
      * 生成视频
      */
     public void generateVideo(String projectId, String projectType, String maxSimulationTime, String taskId) {
-        final Set<String> cpuNodeParallelismKeys = customRedisClient.keys("cpu-node*");
+        final Set<String> cpuNodeParallelismKeys = customRedisClient.keys("esmini-node*");
         // 获取本地 hostname
         final String hostName = OsUtil.getHostName();
-        String cpuNodeParallelismKey = "cpu-node:simulation003:parallelism";
+        String cpuNodeParallelismKey = "esmini-node:simulation003:parallelism";
         for (String tempCpuNodeParallelismKey : cpuNodeParallelismKeys) {
             if (tempCpuNodeParallelismKey.contains(hostName)) {
                 cpuNodeParallelismKey = tempCpuNodeParallelismKey;