root 2 роки тому
батько
коміт
117cc1b904

+ 4 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/scheduler/AlgorithmScheduler.java

@@ -45,10 +45,14 @@ public class AlgorithmScheduler {
         //2 如果已经导入到 docker 中的算法镜像已经达到 maxAlgorithmImage 个,则清理算法镜像到 minAlgorithmImage 个;
         List<String> algorithmIdToUpdateList = new ArrayList<>();
         StringBuilder dockerRmiCommand = new StringBuilder("docker rmi ");
+        StringBuilder registryRmCommand = new StringBuilder("rm -rf ");
         for (int i = minAlgorithmImage; i < algorithmImportedList.size(); i++) {
             AlgorithmPO tempAlgorithm = algorithmImportedList.get(i);
+            String tempAlgorithmId = tempAlgorithm.getId();
+            String algorithmCode = tempAlgorithm.getAlgorithmCode();
             algorithmIdToUpdateList.add(tempAlgorithm.getId());
             dockerRmiCommand.append(tempAlgorithm.getDockerImage());
+            registryRmCommand.append(tempAlgorithmId).append("_").append(algorithmCode);
         }
         //3 修改数据库为未导入
         algorithmMapper.updateDockerImportAndDockerImageByIdList("0", "", algorithmIdToUpdateList);

+ 8 - 7
simulation-resource-video/src/main/java/com/css/simulation/resource/video/controller/VideoController.java

@@ -3,8 +3,8 @@ package com.css.simulation.resource.video.controller;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.util.LinuxUtil;
 import com.css.simulation.resource.video.service.VideoService;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
@@ -15,12 +15,14 @@ public class VideoController {
 
     @Resource
     VideoService videoService;
+    @Value ("${scheduler.video-test-command}")
+    String testCommand;
 
 
     /**
      * 接受 xosc 文件
      */
-    @PostMapping(value = "/generate", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    @RequestMapping(value = "/generate")
     public ResponseBodyVO<String> generateVideo(String projectId, String projectType, String taskId) {
         return videoService.generateVideo(projectId, projectType, taskId);
     }
@@ -29,11 +31,10 @@ public class VideoController {
     /**
      * 接受 xosc 文件
      */
-    @PostMapping(value = "/test", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    @RequestMapping(value = "/test")
     public void testGenerateVideo() throws IOException {
-        LinuxUtil.execute("/root/simulation-cloud/esmini/build/EnvironmentSimulator/code-examples/image-capture/image-capture " +
-                "/root/simulation-cloud/esmini/resources/xosc/lane_change_crest.xosc " +
-                "/root/simulation-cloud/esmini/test/screenshot");
+//        LinuxUtil.execute("/root/disk1/simulation-cloud/esmini/code-examples-bin/image-capture /root/disk1/simulation-cloud/esmini/resources/xosc/lane_change_crest.xosc /root/disk1/simulation-cloud/esmini/test/screenshot ");
+        LinuxUtil.execute(testCommand);
     }
 
 

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

@@ -85,7 +85,7 @@ public class VideoService {
         //4 生成图片
         String pictureDirectoryPath = rootDirectoryPathOfLinux + "picture";
         FileUtil.createDirectory(pictureDirectoryPath);
-        String esminiCommand = "/root/disk1/simulation-cloud/esmini/build/EnvironmentSimulator/code-examples/image-capture/image-capture "
+        String esminiCommand = "/root/disk1/simulation-cloud/esmini/code-examples-bin/image-capture "
                 + xoscPath + " " + pictureDirectoryPath + "/screenshot";
         String esminiResult = LinuxUtil.execute(esminiCommand);
         //5 生成视频