|
@@ -149,7 +149,7 @@ public class ProjectApplicationService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 接收到运行信息立即复制一份数据作为据运行数
|
|
|
+ * 接收到运行信息立即复制一份数据作为运行数据
|
|
|
*
|
|
|
* @param projectStartMessageEntity 项目启动消息
|
|
|
*/
|
|
@@ -179,19 +179,19 @@ public class ProjectApplicationService {
|
|
|
projectStartMessageEntity.setTaskCompleted(0);
|
|
|
//去重,之后发送消息的时候会补全指标,如果不去重的话会出现多个场景重复关联多个指标
|
|
|
Set<SceneEntity> sceneEntitySet = new HashSet<>(sceneEntityList);
|
|
|
- log.info("项目 " + projectId + " 场景包括:" + sceneEntitySet);
|
|
|
+ log.info("项目 {} 场景包括:{}", projectId, sceneEntitySet);
|
|
|
// -------------------------------- 2 算法导入 --------------------------------
|
|
|
- log.info("项目 " + projectId + " 开始算法导入。");
|
|
|
+ log.info("项目 {} 开始算法导入。", projectId);
|
|
|
String algorithmDockerImage = handleAlgorithm(projectId, algorithmId);
|
|
|
- log.info("项目 " + projectId + " 算法已导入:" + algorithmDockerImage);
|
|
|
+ log.info("项目 {} 算法已导入:{}", projectId, algorithmDockerImage);
|
|
|
customRedisClient.set("project:" + projectId + ":docker-image", algorithmDockerImage);
|
|
|
// -------------------------------- 3 查询模型 --------------------------------
|
|
|
- log.info("项目 " + projectId + " 开始查询模型。");
|
|
|
+ log.info("项目 {} 开始查询模型。", projectId);
|
|
|
//1 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
|
|
|
com.css.simulation.resource.scheduler.infra.entity.VehicleEntity vehicleEntity = vehicleMapper.selectByVehicleConfigId(vehicleConfigId); // 车辆
|
|
|
List<CameraEntity> cameraEntityList = sensorCameraMapper.selectCameraByVehicleConfigId(vehicleConfigId); // 摄像头
|
|
|
List<OgtEntity> ogtEntityList = sensorOgtMapper.selectOgtByVehicleId(vehicleConfigId); // 完美传感器
|
|
|
- log.info("项目 " + projectId + " 开始保存任务消息。");
|
|
|
+ log.info("项目 {} 开始保存任务消息。", projectId);
|
|
|
if (DictConstants.MODEL_TYPE_VTD.equals(modelType)) {
|
|
|
// -------------------------------- 4 保存任务消息 --------------------------------
|
|
|
List<TaskEntity> taskList = new ArrayList<>();
|
|
@@ -694,7 +694,7 @@ public class ProjectApplicationService {
|
|
|
String currentNodeName = "";
|
|
|
NodeEntity currentNodeEntity = null;
|
|
|
int currentCount = Integer.MAX_VALUE;
|
|
|
- log.info("各节点已经预定的任务个数为:" + nodeListToCount);
|
|
|
+ log.info("各节点已经预定的任务个数为:{}", nodeListToCount);
|
|
|
for (NodeEntity nodeEntity : nodeListToCount) {
|
|
|
int tempCount = nodeEntity.getCount();
|
|
|
String tempNodeName = nodeEntity.getNodeName();
|
|
@@ -717,7 +717,7 @@ public class ProjectApplicationService {
|
|
|
remainderNodeMap.put(currentNodeName, cpuOrder);
|
|
|
}
|
|
|
// 只有准备启动(即 currentCount == 0)的时候才指定 cpu 编号
|
|
|
- log.info("创建任务 " + taskId + " 的 yaml:是否使用 gpu (0是1否)" + isChoiceGpu + ",当前节点已创建 yaml 个数为:" + currentCount + ",当前节点名称为:" + currentNodeName + ",当前 cpu 编号为:" + cpuOrder + ",镜像名:" + algorithmDockerImage);
|
|
|
+ log.info("创建任务 {} 的 yaml:是否使用 gpu (0是1否){},当前节点已创建 yaml 个数为:{},当前节点名称为:{},当前 cpu 编号为:{},镜像名:{}", taskId, isChoiceGpu, currentCount, currentNodeName, cpuOrder, algorithmDockerImage);
|
|
|
String yamlRedisKey = projectDomainService.createTempYaml(projectId, vehicleConfigId, modelType, algorithmDockerImage, currentNodeName, partition, offset, isChoiceGpu, cpuOrder);
|
|
|
if (currentCount == 0) {
|
|
|
yamlToRunRedisKeyList.add(yamlRedisKey);
|
|
@@ -744,9 +744,9 @@ public class ProjectApplicationService {
|
|
|
}
|
|
|
//1 获取剩余并行度和即将使用的各node的并行度
|
|
|
Map<String, Integer> remainderNodeMap = projectDomainService.getRemainderNodeMap(isChoiceGpu);
|
|
|
- log.info("剩余并行度为:" + remainderNodeMap);
|
|
|
+ log.info("剩余并行度为:{}", remainderNodeMap);
|
|
|
Map<String, Integer> nodeMapToUse = projectDomainService.getNodeMapToUse(isChoiceGpu, expandParallelism);
|
|
|
- log.info("即将使用的并行度为:" + nodeMapToUse);
|
|
|
+ log.info("即将使用的并行度为:{}", nodeMapToUse);
|
|
|
//2 将指定 node 的并行度减少
|
|
|
nodeMapToUse.keySet().forEach(nodeName -> projectDomainService.decrementParallelism(isChoiceGpu, nodeName, nodeMapToUse.get(nodeName)));
|
|
|
//3 获取还未运行的任务 ("project:" + projectId + ":node:" + nodeName + ":yaml")
|
|
@@ -758,7 +758,7 @@ public class ProjectApplicationService {
|
|
|
final String[] split = key.split(":");
|
|
|
return split[3];
|
|
|
}));
|
|
|
- log.info("yaml缓存key根据节点分组之后为:" + yamlPathCacheKeyMapGroupByNodeName);
|
|
|
+ log.info("yaml缓存key根据节点分组之后为:{}", yamlPathCacheKeyMapGroupByNodeName);
|
|
|
// 每个节点分出一部分给两个节点
|
|
|
yamlPathCacheKeyMapGroupByNodeName.forEach((nodeNameBefore, yamlPathCacheKeySetGroupByNodeName) -> {
|
|
|
final int yamlCount = yamlPathCacheKeySetGroupByNodeName.size();
|
|
@@ -845,7 +845,7 @@ public class ProjectApplicationService {
|
|
|
sceneList.addAll(sceneMapper.selectReferenceLibByIdList(sceneReferenceIdList));
|
|
|
}
|
|
|
});
|
|
|
- log.info("项目" + projectId + " 共有 " + sceneList.size() + " 个任务:" + sceneList);
|
|
|
+ log.info("项目{} 共有 {} 个任务:{}", projectId, sceneList.size(), sceneList);
|
|
|
return sceneList;
|
|
|
}
|
|
|
|
|
@@ -865,7 +865,7 @@ public class ProjectApplicationService {
|
|
|
String algorithmDirectoryLinuxTempPath;
|
|
|
String algorithmTarLinuxTempPath = null;
|
|
|
if (algorithmEntity != null) {
|
|
|
- log.info("项目" + projectId + "使用仿真平台自己的算法 " + algorithmEntity);
|
|
|
+ log.info("项目{}使用仿真平台自己的算法 {}", projectId, algorithmEntity);
|
|
|
String algorithmCode = algorithmEntity.getAlgorithmCode();
|
|
|
String dockerImport = algorithmEntity.getDockerImport();
|
|
|
dockerImage = dockerConfiguration.getRegistry() + "/algorithm_" + algorithmCode + ":latest";
|
|
@@ -876,14 +876,14 @@ public class ProjectApplicationService {
|
|
|
if (DictConstants.ALGORITHM_UPLOAD_MODE_FILE.equals(uploadMode)) {
|
|
|
algorithmTarLinuxTempPath = linuxTempPath + "algorithm-file/" + algorithmCode + "/" + algorithmCode + ".tar";
|
|
|
String minioPath = algorithmEntity.getMinioPath();
|
|
|
- log.info("下载 minio 算法文件 " + minioPath + " 到本地 " + algorithmTarLinuxTempPath);
|
|
|
+ log.info("下载 minio 算法文件 {} 到本地 {}", minioPath, algorithmTarLinuxTempPath);
|
|
|
MinioUtil.downloadToFile(minioClient, bucketName, minioPath, algorithmTarLinuxTempPath);
|
|
|
} else if (DictConstants.ALGORITHM_UPLOAD_MODE_GIT.equals(uploadMode)) {
|
|
|
algorithmDirectoryLinuxTempPath = linuxTempPath + "algorithm-git/" + algorithmCode + "/";
|
|
|
String gitUrl = algorithmEntity.getGitUrl().replace(gitConfiguration.getName(), gitConfiguration.getUrl());
|
|
|
String gitUserName = algorithmEntity.getGitUserName();
|
|
|
String gitPassword = algorithmEntity.getGitPassword();
|
|
|
- log.info("下载 git 算法文件 " + gitUrl + " 到本地 " + algorithmDirectoryLinuxTempPath);
|
|
|
+ log.info("下载 git 算法文件 {} 到本地 {}", gitUrl, algorithmDirectoryLinuxTempPath);
|
|
|
GitUtil.clone(gitUrl, gitUserName, gitPassword, algorithmDirectoryLinuxTempPath, true);
|
|
|
for (String filename : Objects.requireNonNull(new File(algorithmDirectoryLinuxTempPath).list())) {
|
|
|
if (filename.endsWith(".tar")) {
|
|
@@ -895,12 +895,12 @@ public class ProjectApplicationService {
|
|
|
}
|
|
|
algorithmMapper.updateDockerImportAndDockerImageById("1", dockerImage, algorithmId);
|
|
|
if (algorithmTarLinuxTempPath == null) {
|
|
|
- throw new RuntimeException("算法" + algorithmId + "下载失败。");
|
|
|
+ throw new RuntimeException("算法" + algorithmId + "下载失败!");
|
|
|
}
|
|
|
OsUtil.exec("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
|
|
|
OsUtil.exec("docker push " + dockerImage);
|
|
|
FileUtil.rm(algorithmTarLinuxTempPath);
|
|
|
- log.info("已删除算法临时文件:" + algorithmTarLinuxTempPath);
|
|
|
+ log.info("已删除算法临时文件:{}", algorithmTarLinuxTempPath);
|
|
|
} else {
|
|
|
throw new RuntimeException("算法 " + algorithmId + " 的 mysql 数据有误!");
|
|
|
}
|
|
@@ -933,7 +933,7 @@ public class ProjectApplicationService {
|
|
|
log.info("算法镜像" + dockerImageWithoutVersion + "已导入。");
|
|
|
}
|
|
|
}
|
|
|
- log.info("项目 " + projectId + " 使用的算法镜像为:" + dockerImage);
|
|
|
+ log.info("项目 {} 使用的算法镜像为:{}", projectId, dockerImage);
|
|
|
|
|
|
return dockerImage;
|
|
|
}
|
|
@@ -952,7 +952,7 @@ public class ProjectApplicationService {
|
|
|
//* -------------------------------- Comment --------------------------------
|
|
|
ProjectEntity projectEntity = projectDomainService.getProjectByProjectId(projectId);
|
|
|
if (projectEntity == null) {
|
|
|
- log.info("项目未运行:" + projectId);
|
|
|
+ log.info("项目未运行:{}", projectId);
|
|
|
return;
|
|
|
}
|
|
|
String projectUserId, clusterUserId, modelType, projectRunningKeyPrefix;
|
|
@@ -968,7 +968,7 @@ public class ProjectApplicationService {
|
|
|
//1 判断项目是否已经运行
|
|
|
projectRunningKeySet = RedisUtil.getKeySetByPrefix(stringRedisTemplate, projectRunningKeyPrefix);
|
|
|
isRunning = !CollectionUtil.isEmpty(projectRunningKeySet);
|
|
|
- //2 将项目状态修改为终止中
|
|
|
+ //2 ----------------------------------------------------- 将项目状态修改为终止中
|
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
projectEntity = simulationManualProjectMapper.selectById(projectId);
|
|
|
simulationManualProjectMapper.updateProjectState(projectId, DictConstants.PROJECT_TERMINATING, TimeUtil.getNowForMysql());
|
|
@@ -1022,7 +1022,8 @@ public class ProjectApplicationService {
|
|
|
//8 删除 minio 残留文件
|
|
|
MinioUtil.rmR(minioClient, bucketName, projectResultPathOfMinio + projectId + "/");
|
|
|
|
|
|
- log.info("项目 " + projectId + " 终止成功!");
|
|
|
+ log.info("项目 {} 终止成功!", projectId);
|
|
|
+ // ----------------------------------------------------------- 修改状态为已终止
|
|
|
if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
simulationManualProjectMapper.updateProjectState(projectId, DictConstants.PROJECT_TERMINATED, TimeUtil.getNowForMysql());
|
|
|
} else {
|