|
@@ -4,19 +4,16 @@ import api.common.pojo.common.ResponseBodyVO;
|
|
import api.common.pojo.constants.DictConstants;
|
|
import api.common.pojo.constants.DictConstants;
|
|
import api.common.util.*;
|
|
import api.common.util.*;
|
|
import com.css.simulation.resource.scheduler.common.configuration.kubernetes.KubernetesConfiguration;
|
|
import com.css.simulation.resource.scheduler.common.configuration.kubernetes.KubernetesConfiguration;
|
|
-import com.css.simulation.resource.scheduler.common.util.KubernetesUtil;
|
|
|
|
-import com.css.simulation.resource.scheduler.dao.mapper.*;
|
|
|
|
-import com.css.simulation.resource.scheduler.service.feign.VideoService;
|
|
|
|
|
|
+import com.css.simulation.resource.scheduler.common.resource.TaskLock;
|
|
|
|
+import com.css.simulation.resource.scheduler.common.util.*;
|
|
import com.css.simulation.resource.scheduler.dao.entity.IndexTemplatePO;
|
|
import com.css.simulation.resource.scheduler.dao.entity.IndexTemplatePO;
|
|
import com.css.simulation.resource.scheduler.dao.entity.LeafIndexPO;
|
|
import com.css.simulation.resource.scheduler.dao.entity.LeafIndexPO;
|
|
import com.css.simulation.resource.scheduler.dao.entity.ProjectPO;
|
|
import com.css.simulation.resource.scheduler.dao.entity.ProjectPO;
|
|
import com.css.simulation.resource.scheduler.dao.entity.TaskPO;
|
|
import com.css.simulation.resource.scheduler.dao.entity.TaskPO;
|
|
|
|
+import com.css.simulation.resource.scheduler.dao.mapper.*;
|
|
import com.css.simulation.resource.scheduler.service.domain.PrefixTO;
|
|
import com.css.simulation.resource.scheduler.service.domain.PrefixTO;
|
|
import com.css.simulation.resource.scheduler.service.domain.ScoreTO;
|
|
import com.css.simulation.resource.scheduler.service.domain.ScoreTO;
|
|
-import com.css.simulation.resource.scheduler.common.resource.TaskLock;
|
|
|
|
-import com.css.simulation.resource.scheduler.common.util.MinioUtil;
|
|
|
|
-import com.css.simulation.resource.scheduler.common.util.ProjectUtil;
|
|
|
|
-import com.css.simulation.resource.scheduler.common.util.RedisUtil;
|
|
|
|
|
|
+import com.css.simulation.resource.scheduler.service.feign.VideoService;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import io.kubernetes.client.openapi.ApiClient;
|
|
import io.kubernetes.client.openapi.ApiClient;
|
|
@@ -28,6 +25,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|
import org.apache.ibatis.session.ExecutorType;
|
|
import org.apache.ibatis.session.ExecutorType;
|
|
import org.apache.ibatis.session.SqlSession;
|
|
import org.apache.ibatis.session.SqlSession;
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
|
+import org.apache.kafka.clients.admin.Admin;
|
|
import org.apache.sshd.client.SshClient;
|
|
import org.apache.sshd.client.SshClient;
|
|
import org.apache.sshd.client.session.ClientSession;
|
|
import org.apache.sshd.client.session.ClientSession;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -99,6 +97,8 @@ public class TaskManager {
|
|
private KubernetesConfiguration kubernetesConfiguration;
|
|
private KubernetesConfiguration kubernetesConfiguration;
|
|
@Resource
|
|
@Resource
|
|
private ApiClient apiClient;
|
|
private ApiClient apiClient;
|
|
|
|
+ @Resource(name = "myKafkaAdmin")
|
|
|
|
+ private Admin admin;
|
|
|
|
|
|
public void batchInsertTask(List<TaskPO> taskPOList) {
|
|
public void batchInsertTask(List<TaskPO> taskPOList) {
|
|
try (SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false)) {
|
|
try (SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false)) {
|
|
@@ -116,7 +116,7 @@ public class TaskManager {
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
public boolean isProjectCompleted(PrefixTO redisPrefix, String projectId, String projectType, String maxSimulationTime, String taskId, String state, String podName) {
|
|
public boolean isProjectCompleted(PrefixTO redisPrefix, String projectId, String projectType, String maxSimulationTime, String taskId, String state, String podName) {
|
|
boolean result = false;
|
|
boolean result = false;
|
|
- String nodeName = projectUtil.getNodeNameOfPod(podName);
|
|
|
|
|
|
+ String nodeName = projectUtil.getNodeNameOfPod(projectId,podName);
|
|
if ("Running".equals(state)) { // 运行中的 pod 无需删除
|
|
if ("Running".equals(state)) { // 运行中的 pod 无需删除
|
|
// 将运行中的任务的 pod 名称放入 redis
|
|
// 将运行中的任务的 pod 名称放入 redis
|
|
stringRedisTemplate.opsForValue().set(redisPrefix.getTaskPodKey(), podName);
|
|
stringRedisTemplate.opsForValue().set(redisPrefix.getTaskPodKey(), podName);
|
|
@@ -193,7 +193,7 @@ public class TaskManager {
|
|
* @param userId 项目创建用户的 id
|
|
* @param userId 项目创建用户的 id
|
|
*/
|
|
*/
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
- public void score(PrefixTO redisPrefix, String userId, String projectId, String projectType, ClientSession session) {
|
|
|
|
|
|
+ public void score(String userId, String projectId, String projectType, ClientSession session) {
|
|
// -------------------------------- 打分 --------------------------------
|
|
// -------------------------------- 打分 --------------------------------
|
|
ProjectPO projectPO = null;
|
|
ProjectPO projectPO = null;
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
@@ -205,7 +205,7 @@ public class TaskManager {
|
|
TimeUnit.SECONDS.sleep(10); // 先等一下数据库更新
|
|
TimeUnit.SECONDS.sleep(10); // 先等一下数据库更新
|
|
List<TaskPO> taskList = taskMapper.selectTaskListByProjectId(projectId); // 所有任务信息
|
|
List<TaskPO> taskList = taskMapper.selectTaskListByProjectId(projectId); // 所有任务信息
|
|
if (CollectionUtil.isEmpty(taskList)) {
|
|
if (CollectionUtil.isEmpty(taskList)) {
|
|
- log.error("TaskManager--score 项目 " + projectId + " 下没有查询到任务!");
|
|
|
|
|
|
+ log.error("项目 " + projectId + " 下没有查询到任务!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
indexMapper.deleteFirstByProjectId(projectId);
|
|
indexMapper.deleteFirstByProjectId(projectId);
|
|
@@ -217,13 +217,7 @@ public class TaskManager {
|
|
String leafIndexTemplateListJson = stringRedisTemplate.opsForValue().get(leafIndexKey);
|
|
String leafIndexTemplateListJson = stringRedisTemplate.opsForValue().get(leafIndexKey);
|
|
List<IndexTemplatePO> allIndexTemplateList = JsonUtil.jsonToList(allIndexTemplateListJson, IndexTemplatePO.class);
|
|
List<IndexTemplatePO> allIndexTemplateList = JsonUtil.jsonToList(allIndexTemplateListJson, IndexTemplatePO.class);
|
|
List<IndexTemplatePO> leafIndexTemplateList = JsonUtil.jsonToList(leafIndexTemplateListJson, IndexTemplatePO.class);
|
|
List<IndexTemplatePO> leafIndexTemplateList = JsonUtil.jsonToList(leafIndexTemplateListJson, IndexTemplatePO.class);
|
|
-// List<IndexTemplatePO> allIndexTemplateList = JsonUtil.jsonToList(
|
|
|
|
-// FileUtil.read(linuxTempPath + "project/" + projectId + "/all-index-list.json"),
|
|
|
|
-// IndexTemplatePO.class);
|
|
|
|
-// List<IndexTemplatePO> leafIndexTemplateList = JsonUtil.jsonToList(
|
|
|
|
-// FileUtil.read(linuxTempPath + "project/" + projectId + "/leaf-index-list.json"),
|
|
|
|
-// IndexTemplatePO.class);
|
|
|
|
- log.info("TaskManager--score 共有 " + leafIndexTemplateList.size() + "个叶子节点:" + leafIndexTemplateListJson);
|
|
|
|
|
|
+ log.info("共有 " + leafIndexTemplateList.size() + "个叶子节点:" + leafIndexTemplateListJson);
|
|
int maxLevel = 1; // 用于计算指标得分
|
|
int maxLevel = 1; // 用于计算指标得分
|
|
List<LeafIndexPO> leafIndexList = new ArrayList<>();
|
|
List<LeafIndexPO> leafIndexList = new ArrayList<>();
|
|
for (int i = 0; i < leafIndexTemplateList.size(); i++) {
|
|
for (int i = 0; i < leafIndexTemplateList.size(); i++) {
|
|
@@ -239,7 +233,7 @@ public class TaskManager {
|
|
if (packageLevel > maxLevel) {
|
|
if (packageLevel > maxLevel) {
|
|
maxLevel = packageLevel;
|
|
maxLevel = packageLevel;
|
|
}
|
|
}
|
|
- log.info("TaskService--state 开始执行对第 " + (i + 1) + " 个叶子节点 " + indexId + " 进行打分!");
|
|
|
|
|
|
+ log.info("开始执行对第 " + (i + 1) + " 个叶子节点 " + indexId + " 进行打分!");
|
|
// 根据叶子指标id查询评分规则创建用户id
|
|
// 根据叶子指标id查询评分规则创建用户id
|
|
String createUserIdOfRule = scoringRulesMapper.selectCreateUserIdByIndexId(indexId);
|
|
String createUserIdOfRule = scoringRulesMapper.selectCreateUserIdByIndexId(indexId);
|
|
//1 判断有没有用户目录,没有则复制
|
|
//1 判断有没有用户目录,没有则复制
|
|
@@ -248,20 +242,18 @@ public class TaskManager {
|
|
// 复制 main.py
|
|
// 复制 main.py
|
|
FileUtil.createDirectory(scoreDirectoryOfUser);
|
|
FileUtil.createDirectory(scoreDirectoryOfUser);
|
|
FileUtil.cpR(pyPath, scoreDirectoryOfUser);
|
|
FileUtil.cpR(pyPath, scoreDirectoryOfUser);
|
|
-// LinuxUtil.execute("cp -r " + pyPath + "* " + scoreDirectoryOfUser);
|
|
|
|
}
|
|
}
|
|
//2 将打分规则保存到script目录
|
|
//2 将打分规则保存到script目录
|
|
|
|
|
|
String ruleFilePath = scoreDirectoryOfUser + "scripts/" + ruleName.split("_")[0] + "/" + ruleName + ".py";
|
|
String ruleFilePath = scoreDirectoryOfUser + "scripts/" + ruleName.split("_")[0] + "/" + ruleName + ".py";
|
|
FileUtil.writeInputStreamToLocalFile(IoUtil.stringToInputStream(ruleDetails), ruleFilePath);
|
|
FileUtil.writeInputStreamToLocalFile(IoUtil.stringToInputStream(ruleDetails), ruleFilePath);
|
|
- log.info("TaskService--state 将叶子节点 " + indexId + " 对应的打分规则保存到临时目录:" + ruleFilePath);
|
|
|
|
|
|
+ log.info("将叶子节点 " + indexId + " 对应的打分规则保存到临时目录:" + ruleFilePath);
|
|
List<TaskPO> taskListOfLeafIndex = taskList.stream()
|
|
List<TaskPO> taskListOfLeafIndex = taskList.stream()
|
|
.filter(task -> indexId.equals(task.getLastTargetId()))
|
|
.filter(task -> indexId.equals(task.getLastTargetId()))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- log.info("TaskService--state 叶子节点 " + indexId + " 包括 " + taskListOfLeafIndex.size() + " 个任务:" + taskListOfLeafIndex);
|
|
|
|
|
|
+ log.info("叶子节点 " + indexId + " 包括 " + taskListOfLeafIndex.size() + " 个任务:" + taskListOfLeafIndex);
|
|
// 计算叶子指标的得分
|
|
// 计算叶子指标的得分
|
|
// 使用 stream 流会出现无法进入循环的情况
|
|
// 使用 stream 流会出现无法进入循环的情况
|
|
- // taskListOfLeafIndex.forEach(taskOfLeaf -> {});
|
|
|
|
for (TaskPO taskOfLeaf : taskListOfLeafIndex) {
|
|
for (TaskPO taskOfLeaf : taskListOfLeafIndex) {
|
|
String task2Id = taskOfLeaf.getId();
|
|
String task2Id = taskOfLeaf.getId();
|
|
|
|
|
|
@@ -277,10 +269,10 @@ public class TaskManager {
|
|
String scoreCommand = "python3 " + scoreDirectoryOfUser + "main.py " + result1OfLinux + " " + result2OfLinux + " " + taskOfLeaf.getSceneType() + " " + ruleName; // 指定打分脚本
|
|
String scoreCommand = "python3 " + scoreDirectoryOfUser + "main.py " + result1OfLinux + " " + result2OfLinux + " " + taskOfLeaf.getSceneType() + " " + ruleName; // 指定打分脚本
|
|
String scoreResult;
|
|
String scoreResult;
|
|
ScoreTO score = null;
|
|
ScoreTO score = null;
|
|
- log.info("TaskService--state 下载 minio 上的结果文件 " + result1OfMinio + " 和 " + result2OfMinio + " 到临时目录:" + linuxTempPath);
|
|
|
|
|
|
+ log.info("下载 minio 上的结果文件 " + result1OfMinio + " 和 " + result2OfMinio + " 到临时目录:" + linuxTempPath);
|
|
MinioUtil.downloadToFile(minioClient, bucketName, result1OfMinio, result1OfLinux); // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
|
|
MinioUtil.downloadToFile(minioClient, bucketName, result1OfMinio, result1OfLinux); // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
|
|
MinioUtil.downloadToFile(minioClient, bucketName, result2OfMinio, result2OfLinux); // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
|
|
MinioUtil.downloadToFile(minioClient, bucketName, result2OfMinio, result2OfLinux); // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
|
|
- log.info("TaskService--state 开始执行打分命令:" + scoreCommand);
|
|
|
|
|
|
+ log.info("开始执行打分命令:" + scoreCommand);
|
|
Runtime r = Runtime.getRuntime();
|
|
Runtime r = Runtime.getRuntime();
|
|
Process p = r.exec(scoreCommand, null, new File(scoreDirectoryOfUser));
|
|
Process p = r.exec(scoreCommand, null, new File(scoreDirectoryOfUser));
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
|
@@ -290,13 +282,12 @@ public class TaskManager {
|
|
sb.append(inline).append("\n");
|
|
sb.append(inline).append("\n");
|
|
}
|
|
}
|
|
scoreResult = sb.toString();
|
|
scoreResult = sb.toString();
|
|
-// scoreResult = SshUtil.execute(session, scoreCommand);
|
|
|
|
- log.info("TaskService--state 项目" + projectId + " 的任务 " + task2Id + " 打分结束,结果为:" + scoreResult);
|
|
|
|
|
|
+ log.info("项目" + projectId + " 的任务 " + task2Id + " 打分结束,结果为:" + scoreResult);
|
|
String replace = StringUtil.replace(scoreResult, "'", "\"");
|
|
String replace = StringUtil.replace(scoreResult, "'", "\"");
|
|
try {
|
|
try {
|
|
score = JsonUtil.jsonToBean(replace, ScoreTO.class);
|
|
score = JsonUtil.jsonToBean(replace, ScoreTO.class);
|
|
} catch (Exception e) { // 打分失败
|
|
} catch (Exception e) { // 打分失败
|
|
- log.info("TaskManager--state 项目" + projectId + " 的任务 " + task2Id + " 打分失败:", e);
|
|
|
|
|
|
+ log.info("项目" + projectId + " 的任务 " + task2Id + " 打分失败:", e);
|
|
}
|
|
}
|
|
if (score != null) {
|
|
if (score != null) {
|
|
taskOfLeaf.setReturnSceneId(score.getUnit_scene_ID());
|
|
taskOfLeaf.setReturnSceneId(score.getUnit_scene_ID());
|
|
@@ -322,9 +313,6 @@ public class TaskManager {
|
|
taskOfLeaf.setScored(false);
|
|
taskOfLeaf.setScored(false);
|
|
taskMapper.updateFailStateWithStopTime(task2Id, DictConstants.TASK_ABORTED, TimeUtil.getNowForMysql(), DictConstants.TASK_ERROR_REASON_5);
|
|
taskMapper.updateFailStateWithStopTime(task2Id, DictConstants.TASK_ABORTED, TimeUtil.getNowForMysql(), DictConstants.TASK_ERROR_REASON_5);
|
|
}
|
|
}
|
|
- // 删除打分使用的文件
|
|
|
|
-// FileUtil.rm(result1OfLinux);
|
|
|
|
-// FileUtil.rm(result2OfLinux);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -355,7 +343,7 @@ public class TaskManager {
|
|
|
|
|
|
// 计算任务的个数
|
|
// 计算任务的个数
|
|
long taskNumberToScore = taskListOfLeafIndex.size();
|
|
long taskNumberToScore = taskListOfLeafIndex.size();
|
|
- log.info("TaskManager--score 项目 " + projectId + " 的叶子指标 " + indexId
|
|
|
|
|
|
+ log.info("项目 " + projectId + " 的叶子指标 " + indexId
|
|
+ " 下参与计算的任务总数为 " + taskNumberToScore
|
|
+ " 下参与计算的任务总数为 " + taskNumberToScore
|
|
+ ":仿真异常场景个数 " + errorSceneNumber
|
|
+ ":仿真异常场景个数 " + errorSceneNumber
|
|
+ "、未达标场景个数 " + notStandardSceneNumber
|
|
+ "、未达标场景个数 " + notStandardSceneNumber
|
|
@@ -394,14 +382,14 @@ public class TaskManager {
|
|
// 保存叶子指标得分
|
|
// 保存叶子指标得分
|
|
taskIndexManager.batchInsertLeafIndex(leafIndexList);
|
|
taskIndexManager.batchInsertLeafIndex(leafIndexList);
|
|
// 保存一级指标分数
|
|
// 保存一级指标分数
|
|
- log.info("TaskManager--score 项目 " + projectId + " 的所有任务分数为:" + taskList);
|
|
|
|
|
|
+ log.info("项目 " + projectId + " 的所有任务分数为:" + taskList);
|
|
computeFirst(leafIndexList, allIndexTemplateList, projectId, maxLevel);
|
|
computeFirst(leafIndexList, allIndexTemplateList, projectId, maxLevel);
|
|
- log.info("TaskManager--score 项目 " + projectId + " 打分完成!");
|
|
|
|
|
|
+ log.info("项目 " + projectId + " 打分完成!");
|
|
}
|
|
}
|
|
|
|
|
|
public void computeFirst(List<LeafIndexPO> leafIndexList, List<IndexTemplatePO> allIndexTemplateList, String projectId, int maxLevel) {
|
|
public void computeFirst(List<LeafIndexPO> leafIndexList, List<IndexTemplatePO> allIndexTemplateList, String projectId, int maxLevel) {
|
|
|
|
|
|
- log.info("------- /state computeFirst 计算父指标得分:" + leafIndexList);
|
|
|
|
|
|
+ log.info("计算父指标得分:" + leafIndexList);
|
|
Iterator<LeafIndexPO> leafTaskIndexIterator = leafIndexList.iterator();
|
|
Iterator<LeafIndexPO> leafTaskIndexIterator = leafIndexList.iterator();
|
|
// 把 1 级的指标得分直接保存
|
|
// 把 1 级的指标得分直接保存
|
|
while (leafTaskIndexIterator.hasNext()) {
|
|
while (leafTaskIndexIterator.hasNext()) {
|
|
@@ -460,18 +448,18 @@ public class TaskManager {
|
|
String tokenUrl = tokenUri + "?grant_type=client_credentials"
|
|
String tokenUrl = tokenUri + "?grant_type=client_credentials"
|
|
+ "&client_id=" + clientId
|
|
+ "&client_id=" + clientId
|
|
+ "&client_secret=" + clientSecret;
|
|
+ "&client_secret=" + clientSecret;
|
|
- log.info("TaskService--state 获取仿真云平台 token:" + tokenUrl);
|
|
|
|
|
|
+ log.info("获取仿真云平台 token:" + tokenUrl);
|
|
String response = HttpUtil.get(closeableHttpClient, requestConfig, tokenUrl);
|
|
String response = HttpUtil.get(closeableHttpClient, requestConfig, tokenUrl);
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
JsonNode jsonNode = objectMapper.readTree(response);
|
|
JsonNode jsonNode = objectMapper.readTree(response);
|
|
String accessToken = jsonNode.path("access_token").asText();
|
|
String accessToken = jsonNode.path("access_token").asText();
|
|
- log.info("TaskService--state 仿真云平台 token 为:" + accessToken);
|
|
|
|
|
|
+ log.info("仿真云平台 token 为:" + accessToken);
|
|
Map<String, String> headers = new HashMap<>();
|
|
Map<String, String> headers = new HashMap<>();
|
|
headers.put("Authorization", "Bearer " + accessToken);
|
|
headers.put("Authorization", "Bearer " + accessToken);
|
|
Map<String, String> params = new HashMap<>();
|
|
Map<String, String> params = new HashMap<>();
|
|
params.put("id", projectId);
|
|
params.put("id", projectId);
|
|
String post = HttpUtil.post(closeableHttpClient, requestConfig, evaluationLevelUri, headers, params);
|
|
String post = HttpUtil.post(closeableHttpClient, requestConfig, evaluationLevelUri, headers, params);
|
|
- log.info("TaskService--state 访问仿真云平台评价等级接口:" + evaluationLevelUri + ",请求头为:" + headers + ",请求体为:" + params + "结果为:" + post);
|
|
|
|
|
|
+ log.info("访问仿真云平台评价等级接口:" + evaluationLevelUri + ",请求头为:" + headers + ",请求体为:" + params + "结果为:" + post);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -508,25 +496,18 @@ public class TaskManager {
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
autoSubProjectMapper.updateProjectState(projectId, DictConstants.PROJECT_COMPLETED, TimeUtil.getNowForMysql());
|
|
autoSubProjectMapper.updateProjectState(projectId, DictConstants.PROJECT_COMPLETED, TimeUtil.getNowForMysql());
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
// 删除 kafka topic
|
|
// 删除 kafka topic
|
|
-// SshClient clientKafka = SshUtil.getClient();
|
|
|
|
-// ClientSession sessionKafka = SshUtil.getSession(clientKafka, hostnameKafka, usernameKafka, passwordKafka);
|
|
|
|
-// String topicDeleteCommand = StringUtil.replace(kafkaDeleteCommand, "topicName", projectId);
|
|
|
|
-// SshUtil.execute(sessionKafka, topicDeleteCommand);
|
|
|
|
-// SshUtil.stop(clientKafka, sessionKafka);
|
|
|
|
|
|
+ ApacheKafkaUtil.deleteTopic(admin, projectId);
|
|
|
|
|
|
// 删除 redis 中的 项目运行信息 键值对
|
|
// 删除 redis 中的 项目运行信息 键值对
|
|
RedisUtil.deleteByPrefix(stringRedisTemplate, redisPrefix.getProjectRunningKey());
|
|
RedisUtil.deleteByPrefix(stringRedisTemplate, redisPrefix.getProjectRunningKey());
|
|
RedisUtil.deleteByPrefix(stringRedisTemplate, "project:" + projectId);
|
|
RedisUtil.deleteByPrefix(stringRedisTemplate, "project:" + projectId);
|
|
- RedisUtil.deleteByPrefix(stringRedisTemplate, "pod:project-" + projectId);
|
|
|
|
// 删除剩余 yaml
|
|
// 删除剩余 yaml
|
|
projectUtil.deleteYamlByProjectId(projectId);
|
|
projectUtil.deleteYamlByProjectId(projectId);
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
- log.info("done() 手动运行项目 " + projectId + " 执行完成!");
|
|
|
|
|
|
+ log.info("手动运行项目 " + projectId + " 执行完成!");
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
} else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
- log.info("done() 自动运行子项目 " + projectId + " 执行完成!");
|
|
|
|
|
|
+ log.info("自动运行子项目 " + projectId + " 执行完成!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|