|
@@ -11,6 +11,7 @@ import com.css.simulation.resource.scheduler.feign.CommonService;
|
|
|
import com.css.simulation.resource.scheduler.mapper.*;
|
|
|
import com.css.simulation.resource.scheduler.pojo.dto.*;
|
|
|
import com.css.simulation.resource.scheduler.pojo.po.*;
|
|
|
+import com.github.dockerjava.api.DockerClient;
|
|
|
import feign.Response;
|
|
|
import io.kubernetes.client.openapi.ApiClient;
|
|
|
import io.kubernetes.client.openapi.ApiException;
|
|
@@ -57,8 +58,11 @@ public class ManualProjectConsumer {
|
|
|
private ApiClient apiClient;
|
|
|
@Value("${spring.kafka.consumer.topic.manual-project}")
|
|
|
private String manualProjectTopic;
|
|
|
- @Value("${scheduler.manual-project.result-path}")
|
|
|
+ @Value("${scheduler.manual-project.result-path-minio}")
|
|
|
private String manualProjectResultPath;
|
|
|
+ @Value("${scheduler.temp-path-linux}")
|
|
|
+ private String tempPath;
|
|
|
+
|
|
|
|
|
|
@KafkaListener(groupId = "simulation-resource-scheduler", topics = "${spring.kafka.consumer.topic.manual-project}")
|
|
|
public void testConsumer(ConsumerRecord<String, String> projectRecord) {
|
|
@@ -187,15 +191,13 @@ public class ManualProjectConsumer {
|
|
|
// -------------------------------- 4 算法(一期按单机版做) --------------------------------
|
|
|
// 私有仓库导入算法镜像(搭建私有仓库)
|
|
|
String algorithmId = projectMessageDTO.getAlgorithmId(); // 算法 id
|
|
|
- String localPath = "/opt/module/algorithm/";
|
|
|
//4-1 根据算法 id 获取算法文件地址
|
|
|
String minioPath = algorithmMapper.selectMinioPathById(algorithmId);
|
|
|
+ String linuxPath = tempPath + minioPath.substring(1);
|
|
|
// 下载算法文件到本地( 2 到仓库服务器)
|
|
|
Response response = commonService.download(new MinioParameter(minioPath));
|
|
|
InputStream inputStream = response.body().asInputStream();
|
|
|
- FileUtil.writeInputStreamToLocalFile(inputStream, localPath);
|
|
|
- //4-2 本地执行 docker load 算法文件成镜像( 2 创建 ssh 连接)
|
|
|
- LinuxUtil.execute("docker load");
|
|
|
+ //4-2 本地执行 docker load 算法文件成镜像(二期用 docker-java 操作 或 ssh 连接)
|
|
|
|
|
|
|
|
|
// -------------------------------- 5 创建 pod 开始执行 --------------------------------
|