Procházet zdrojové kódy

增加算法仓库

martin před 2 roky
rodič
revize
18c5c61362

+ 1 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/configuration/docker/DockerConfiguration.java

@@ -8,6 +8,7 @@ import org.springframework.context.annotation.Configuration;
 @ConfigurationProperties(prefix = "docker")
 @Data
 public class DockerConfiguration {
+    private String registry;
     private Integer maxAlgorithmImage;
     private Integer minAlgorithmImage;
 }

+ 2 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ProjectConsumer.java

@@ -66,6 +66,8 @@ public class ProjectConsumer {
     ProjectUtil projectUtil;
 
 
+
+
     /**
      * 任务运行前首先判断用户是否拥有可分配资源
      *

+ 6 - 3
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/service/ProjectService.java

@@ -3,6 +3,7 @@ package com.css.simulation.resource.scheduler.service;
 import api.common.pojo.constants.DictConstants;
 import api.common.pojo.dto.ProjectMessageDTO;
 import api.common.util.*;
+import com.css.simulation.resource.scheduler.configuration.docker.DockerConfiguration;
 import com.css.simulation.resource.scheduler.mapper.*;
 import com.css.simulation.resource.scheduler.pojo.po.*;
 import com.css.simulation.resource.scheduler.pojo.to.*;
@@ -95,6 +96,8 @@ public class ProjectService {
     ApiClient apiClient;
     @Resource
     ProjectUtil projectUtil;
+    @Resource
+    DockerConfiguration dockerConfiguration;
 
 
     // -------------------------------- Comment --------------------------------
@@ -335,12 +338,12 @@ public class ProjectService {
     public String handleAlgorithm(String projectId, String algorithmId) {
         //4-1 根据算法 id 获取算法文件地址、是否已导入成镜像。
         AlgorithmPO algorithmPO = algorithmMapper.selectById(algorithmId);
-        String dockerImage;
+        String dockerImage = dockerConfiguration.getRegistry() + "/";
         String algorithmTarLinuxTempPath;
         if (algorithmPO != null) { // 使用仿真平台自己的算法
             String algorithmCode = algorithmPO.getAlgorithmCode();
             String dockerImport = algorithmPO.getDockerImport();
-            dockerImage = "algorithm_" + algorithmCode + ":latest";
+            dockerImage += "algorithm_" + algorithmCode + ":latest";
             algorithmTarLinuxTempPath = linuxTempPath + "algorithm/" + algorithmCode + ".tar";
             if ("1".equals(dockerImport) && StringUtil.isNotEmpty(dockerImport)) { // 已经导入同时存在镜像名称
                 dockerImage = algorithmPO.getDockerImage();
@@ -369,7 +372,7 @@ public class ProjectService {
             log.info("ProjectService--handleAlgorithm 项目" + projectId + "需要从索为平台下载算法 " + algorithmId);
             algorithmTarLinuxTempPath = linuxTempPath + "algorithm/" + algorithmId + ".tar";
             String dockerImageWithoutVersion = "algorithm_" + algorithmId;
-            dockerImage = dockerImageWithoutVersion + ":latest";
+            dockerImage += dockerImageWithoutVersion + ":latest";
             //0 查看算法是否已经导入
             if (!projectUtil.isImported(dockerImageWithoutVersion)) {
                 //1 获取 token