|
@@ -202,32 +202,33 @@ public class ManualProjectConsumer {
|
|
|
commonService.send(new KafkaParameter(projectId, taskJson));
|
|
|
}
|
|
|
|
|
|
- // -------------------------------- 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 到仓库服务器)
|
|
|
- Response response = commonService.download(new MinioParameter(minioPath));
|
|
|
- InputStream inputStream = response.body().asInputStream();
|
|
|
- FileUtil.writeInputStreamToLocalFile(inputStream, 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 数据有误!");
|
|
|
- }
|
|
|
+ // -------------------------------- 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 到仓库服务器)
|
|
|
+// Response response = commonService.download(new MinioParameter(minioPath));
|
|
|
+// InputStream inputStream = response.body().asInputStream();
|
|
|
+// FileUtil.writeInputStreamToLocalFile(inputStream, 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(); // 并行度
|
|
|
BatchV1Api batchV1Api = new BatchV1Api(apiClient);
|
|
|
- V1Job yaml = (V1Job) Yaml.load(ResourceUtils.getFile("classpath:kubernetes/template/job-template.yaml"));
|
|
|
+// V1Job yaml = (V1Job) Yaml.load(ResourceUtils.getFile("classpath:kubernetes/template/job-template.yaml"));
|
|
|
+ V1Job yaml = (V1Job) Yaml.load(ResourceUtils.getFile("classpath:kubernetes/template/job-test.yaml"));
|
|
|
//1 apiVersion
|
|
|
//2 kind
|
|
|
//3 metadata
|
|
@@ -249,12 +250,12 @@ public class ManualProjectConsumer {
|
|
|
}
|
|
|
if ("algorithm".equals(name)) {
|
|
|
container.setName("algorithm_" + projectId);
|
|
|
- container.setImage(dockerImage);
|
|
|
+// container.setImage(dockerImage);
|
|
|
}
|
|
|
}
|
|
|
//4-4 创建
|
|
|
yaml.setSpec(job);
|
|
|
- batchV1Api.createNamespacedJob("simulation-task", yaml, null, null, null);
|
|
|
+ batchV1Api.createNamespacedJob("simulation-cloud", yaml, null, null, null);
|
|
|
}
|
|
|
|
|
|
|