|
@@ -2,10 +2,9 @@ package com.css.simulation.resource.scheduler.scheduler;
|
|
|
|
|
|
import api.common.util.SshUtil;
|
|
|
import com.css.simulation.resource.scheduler.configuration.docker.DockerConfiguration;
|
|
|
-import com.css.simulation.resource.scheduler.configuration.kubernetes.KubernetesConfiguration;
|
|
|
import com.css.simulation.resource.scheduler.mapper.AlgorithmMapper;
|
|
|
import com.css.simulation.resource.scheduler.pojo.po.AlgorithmPO;
|
|
|
-import com.css.simulation.resource.scheduler.pojo.to.KubernetesNodeTO;
|
|
|
+import com.css.simulation.resource.scheduler.pojo.to.DockerNodeTO;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.sshd.client.SshClient;
|
|
@@ -21,8 +20,6 @@ import java.util.List;
|
|
|
@Slf4j
|
|
|
public class AlgorithmScheduler {
|
|
|
|
|
|
- @Resource
|
|
|
- KubernetesConfiguration kubernetesConfiguration;
|
|
|
@Resource
|
|
|
DockerConfiguration dockerConfiguration;
|
|
|
@Resource
|
|
@@ -56,11 +53,11 @@ public class AlgorithmScheduler {
|
|
|
//3 修改数据库为未导入
|
|
|
algorithmMapper.updateDockerImportAndDockerImageByIdList("0", "", algorithmIdToUpdateList);
|
|
|
//4 删除镜像
|
|
|
- List<KubernetesNodeTO> nodeList = kubernetesConfiguration.getNodeList();
|
|
|
- for (KubernetesNodeTO kubernetesNodeTO : nodeList) {
|
|
|
- String hostname = kubernetesNodeTO.getHostname();
|
|
|
- String username = kubernetesNodeTO.getUsername();
|
|
|
- String password = kubernetesNodeTO.getPassword();
|
|
|
+ List<DockerNodeTO> nodeList = dockerConfiguration.getNodeList();
|
|
|
+ for (DockerNodeTO dockerNodeTO : nodeList) {
|
|
|
+ String hostname = dockerNodeTO.getHostname();
|
|
|
+ String username = dockerNodeTO.getUsername();
|
|
|
+ String password = dockerNodeTO.getPassword();
|
|
|
SshClient client = SshUtil.getClient();
|
|
|
ClientSession session = SshUtil.getSession(client, hostname, username, password);
|
|
|
SshUtil.execute(session, dockerRmiCommand.toString());
|