|
@@ -3,13 +3,11 @@ package com.css.simulation.resource.scheduler.consumer;
|
|
|
|
|
|
import api.common.pojo.constants.DictConstants;
|
|
|
import api.common.pojo.dto.ProjectMessageDTO;
|
|
|
-import api.common.util.CollectionUtil;
|
|
|
-import api.common.util.JsonUtil;
|
|
|
-import api.common.util.StringUtil;
|
|
|
-import api.common.util.TimeUtil;
|
|
|
+import api.common.util.*;
|
|
|
import com.css.simulation.resource.scheduler.mapper.*;
|
|
|
import com.css.simulation.resource.scheduler.pojo.po.*;
|
|
|
import com.css.simulation.resource.scheduler.pojo.to.*;
|
|
|
+import com.css.simulation.resource.scheduler.util.MinioUtil;
|
|
|
import io.kubernetes.client.openapi.ApiClient;
|
|
|
import io.kubernetes.client.openapi.apis.BatchV1Api;
|
|
|
import io.kubernetes.client.openapi.models.V1Job;
|
|
@@ -228,24 +226,27 @@ public class ManualProjectConsumer {
|
|
|
}
|
|
|
|
|
|
// -------------------------------- 4 算法导入(一期按单机版做) --------------------------------
|
|
|
-// // 私有仓库导入算法镜像
|
|
|
-// String algorithmId = projectMessageDTO.getAlgorithmId(); // 算法 id
|
|
|
-// //4-1 根据算法 id 获取算法文件地址、是否已导入成镜像。
|
|
|
-// AlgorithmPO algorithmPO = algorithmMapper.selectById(algorithmId);
|
|
|
-// String minioPath = algorithmPO.getMinioPath();
|
|
|
-// String dockerImage;
|
|
|
-// if ("0".equals(algorithmPO.getDockerImport())) {
|
|
|
-// dockerImage = "algorithm_" + algorithmId + ":latest";
|
|
|
-// String algorithmTarLinuxTempPath = linuxTempPath + minioPath;
|
|
|
-// // 下载算法文件到本地( 2 到仓库服务器)
|
|
|
-// MinioUtil.downloadToFile(minioClient, bucketName, minioPath, algorithmTarLinuxTempPath);
|
|
|
-// //4-2 本地执行 docker load 算法文件成镜像(集群版可改成用 docker-java 操作仓库)
|
|
|
-// LinuxUtil.execute("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
|
|
|
-// } else if ("1".equals(algorithmPO.getDockerImport()) && StringUtil.isNotEmpty(algorithmPO.getDockerImage())) {
|
|
|
-// dockerImage = algorithmPO.getDockerImage();
|
|
|
-// } else {
|
|
|
-// throw new RuntimeException("算法 " + algorithmId + "的 mysql 数据有误!");
|
|
|
-// }
|
|
|
+ // 私有仓库导入算法镜像
|
|
|
+ String algorithmId = projectMessageDTO.getAlgorithmId(); // 算法 id
|
|
|
+ //4-1 根据算法 id 获取算法文件地址、是否已导入成镜像。
|
|
|
+ AlgorithmPO algorithmPO = algorithmMapper.selectById(algorithmId);
|
|
|
+ if (algorithmPO == null){
|
|
|
+ // 访问索为远程接口
|
|
|
+ }
|
|
|
+ String minioPath = algorithmPO.getMinioPath();
|
|
|
+ String dockerImage;
|
|
|
+ if ("0".equals(algorithmPO.getDockerImport())) {
|
|
|
+ dockerImage = "algorithm_" + algorithmId + ":latest";
|
|
|
+ String algorithmTarLinuxTempPath = linuxTempPath + minioPath;
|
|
|
+ // 下载算法文件到本地( 2 到仓库服务器)
|
|
|
+ MinioUtil.downloadToFile(minioClient, bucketName, minioPath, algorithmTarLinuxTempPath);
|
|
|
+ //4-2 本地执行 docker load 算法文件成镜像(集群版可改成用 docker-java 操作仓库)
|
|
|
+ LinuxUtil.execute("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
|
|
|
+ } else if ("1".equals(algorithmPO.getDockerImport()) && StringUtil.isNotEmpty(algorithmPO.getDockerImage())) {
|
|
|
+ dockerImage = algorithmPO.getDockerImage();
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("算法 " + algorithmId + "的 mysql 数据有误!");
|
|
|
+ }
|
|
|
// -------------------------------- 5 创建 pod 开始执行 --------------------------------
|
|
|
int completions = sceneList.size(); // 结束标
|
|
|
int parallelism = projectMessageDTO.getParallelism(); // 并行度
|