|
@@ -14,18 +14,16 @@ import com.css.simulation.resource.scheduler.infrastructure.configuration.git.Gi
|
|
import com.css.simulation.resource.scheduler.infrastructure.configuration.kubernetes.KubernetesConfiguration;
|
|
import com.css.simulation.resource.scheduler.infrastructure.configuration.kubernetes.KubernetesConfiguration;
|
|
import com.css.simulation.resource.scheduler.infrastructure.configuration.minio.MinioConfiguration;
|
|
import com.css.simulation.resource.scheduler.infrastructure.configuration.minio.MinioConfiguration;
|
|
import com.css.simulation.resource.scheduler.infrastructure.entity.*;
|
|
import com.css.simulation.resource.scheduler.infrastructure.entity.*;
|
|
-import com.css.simulation.resource.scheduler.infrastructure.persistence.mysql.mapper.*;
|
|
|
|
-import com.css.simulation.resource.scheduler.infrastructure.persistence.redis.CustomRedisClient;
|
|
|
|
-import com.css.simulation.resource.scheduler.infrastructure.persistence.kafka.KafkaUtil;
|
|
|
|
import com.css.simulation.resource.scheduler.infrastructure.persistence.git.GitUtil;
|
|
import com.css.simulation.resource.scheduler.infrastructure.persistence.git.GitUtil;
|
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.persistence.kafka.KafkaUtil;
|
|
import com.css.simulation.resource.scheduler.infrastructure.persistence.minio.MinioUtil;
|
|
import com.css.simulation.resource.scheduler.infrastructure.persistence.minio.MinioUtil;
|
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.persistence.mysql.mapper.*;
|
|
|
|
+import com.css.simulation.resource.scheduler.infrastructure.persistence.redis.CustomRedisClient;
|
|
import com.css.simulation.resource.scheduler.infrastructure.persistence.redis.RedisUtil;
|
|
import com.css.simulation.resource.scheduler.infrastructure.persistence.redis.RedisUtil;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import io.minio.MinioClient;
|
|
import io.minio.MinioClient;
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.apache.http.client.config.RequestConfig;
|
|
|
|
-import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
|
import org.apache.kafka.clients.admin.Admin;
|
|
import org.apache.kafka.clients.admin.Admin;
|
|
import org.apache.kafka.clients.producer.RecordMetadata;
|
|
import org.apache.kafka.clients.producer.RecordMetadata;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -98,10 +96,6 @@ public class ProjectService {
|
|
@Resource
|
|
@Resource
|
|
private ProjectDomainService projectDomainService;
|
|
private ProjectDomainService projectDomainService;
|
|
@Resource
|
|
@Resource
|
|
- private CloseableHttpClient closeableHttpClient;
|
|
|
|
- @Resource
|
|
|
|
- private RequestConfig requestConfig;
|
|
|
|
- @Resource
|
|
|
|
private IndexTemplateMapper indexTemplateMapper;
|
|
private IndexTemplateMapper indexTemplateMapper;
|
|
@Resource
|
|
@Resource
|
|
private SceneMapper sceneMapper;
|
|
private SceneMapper sceneMapper;
|
|
@@ -759,14 +753,14 @@ public class ProjectService {
|
|
if (!projectDomainService.isImported(dockerImageWithoutVersion)) {
|
|
if (!projectDomainService.isImported(dockerImageWithoutVersion)) {
|
|
//1 获取 token
|
|
//1 获取 token
|
|
String tokenUrl = customConfiguration.getAlgorithmPlatformTokenUri() + "?grant_type=client_credential&appid=" + customConfiguration.getAlgorithmPlatformAppid() + "&secret=" + customConfiguration.getAlgorithmPlatformSecret();
|
|
String tokenUrl = customConfiguration.getAlgorithmPlatformTokenUri() + "?grant_type=client_credential&appid=" + customConfiguration.getAlgorithmPlatformAppid() + "&secret=" + customConfiguration.getAlgorithmPlatformSecret();
|
|
- String tokenJson = HttpUtil.get(closeableHttpClient, requestConfig, tokenUrl);
|
|
|
|
|
|
+ String tokenJson = HttpUtil.get(tokenUrl);
|
|
String token = new ObjectMapper().readTree(tokenJson).path("data").path("access_token").asText();
|
|
String token = new ObjectMapper().readTree(tokenJson).path("data").path("access_token").asText();
|
|
//2 获取 下载地址
|
|
//2 获取 下载地址
|
|
String downloadUrl = customConfiguration.getAlgorithmPlatformAlgorithmAddrUri() + "?access_token=" + token + "&id=" + algorithmId;
|
|
String downloadUrl = customConfiguration.getAlgorithmPlatformAlgorithmAddrUri() + "?access_token=" + token + "&id=" + algorithmId;
|
|
//3 下载算法包
|
|
//3 下载算法包
|
|
- String downloadUrlJson = HttpUtil.get(closeableHttpClient, requestConfig, downloadUrl);
|
|
|
|
|
|
+ String downloadUrlJson = HttpUtil.get(downloadUrl);
|
|
String tempDownloadUrl = new ObjectMapper().readTree(downloadUrlJson).path("data").asText();
|
|
String tempDownloadUrl = new ObjectMapper().readTree(downloadUrlJson).path("data").asText();
|
|
- InputStream inputStream = HttpUtil.getInputStream(closeableHttpClient, requestConfig, tempDownloadUrl);
|
|
|
|
|
|
+ InputStream inputStream = HttpUtil.getInputStream(tempDownloadUrl);
|
|
FileUtil.writeInputStreamToLocalFile(inputStream, algorithmTarLinuxTempPath);
|
|
FileUtil.writeInputStreamToLocalFile(inputStream, algorithmTarLinuxTempPath);
|
|
// 本地执行 docker import 算法文件成镜像(可改成用 docker-java 操作仓库)
|
|
// 本地执行 docker import 算法文件成镜像(可改成用 docker-java 操作仓库)
|
|
LinuxUtil.execute("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
|
|
LinuxUtil.execute("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
|