修改:hpc任务列表查询优化

This commit is contained in:
yangyang01000846
2025-12-29 11:29:45 +08:00
parent bff129af8e
commit 8047cde038
2 changed files with 14 additions and 8 deletions

View File

@@ -10,4 +10,7 @@ public class QueryJobReq extends BaseReq {
@Schema(description = "计算任务名称")
private String jobName;
@Schema(description = "求解器名称")
private String solverName;
}

View File

@@ -76,6 +76,7 @@ public class PbsServiceDecorator implements IPbsServiceDecorator {
public SdmResponse<String> submitHpcJob(SubmitHpcTaskReq req) {
//1. 上传hpc主文件 及 其他文件
MultipartFile masterFile = req.getMasterFile();
// hpc共享机器+ subDir 这个就确定是工作目录了
String subDir = req.getJobName()+"\\"+System.currentTimeMillis();
// webClient 调用上传这个是主文件求解算出的文件及stdout文件都指定这个文件夹下面
String masterFilePath = hpcCommandExcuteUtil.uploaHpcFile(masterFile,subDir);
@@ -83,7 +84,7 @@ public class PbsServiceDecorator implements IPbsServiceDecorator {
// 任务输出的文件夹
String hpcOutPutDir = extractDirectory(masterFilePath);
req.setWorkDir(hpcOutPutDir);
// 前置处理 替换求解文件 todo 从数据库查询
// 前置处理 替换求解文件
String command="";
if(StringUtils.isNotBlank(req.getCommand())) {
command=req.getCommand();
@@ -184,15 +185,12 @@ public class PbsServiceDecorator implements IPbsServiceDecorator {
if (fullPath == null || fullPath.isEmpty()) {
return fullPath;
}
// 找到最后一个反斜杠的位置
int lastSeparatorIndex = fullPath.lastIndexOf("\\");
// 若没有找到分隔符,返回原路径;否则截取到最后一个分隔符(包含)
if (lastSeparatorIndex == -1) {
return fullPath;
}
return fullPath.substring(0, lastSeparatorIndex + 1);
}
@@ -240,10 +238,15 @@ public class PbsServiceDecorator implements IPbsServiceDecorator {
public SdmResponse<PageDataResp<List<SimulationJob>>> queryJobs(QueryJobReq req){
PageHelper.startPage(req.getCurrent(), req.getSize());
// 构建查询条件
LambdaQueryChainWrapper<SimulationJob> queryChain = simulationJobService.lambdaQuery();
if (req.getJobName() != null && !req.getJobName().trim().isEmpty()) {
queryChain.eq(SimulationJob::getJobName, req.getJobName().trim());
}
LambdaQueryChainWrapper<SimulationJob> queryChain = simulationJobService.lambdaQuery();
if (req.getJobName() != null && !req.getJobName().trim().isEmpty()) {
// like实现 包含关键词 的模糊查询(%关键词%
queryChain.like(SimulationJob::getJobName, req.getJobName().trim());
}
if (req.getSolverName() != null && !req.getSolverName().trim().isEmpty()) {
// like实现 包含关键词 的模糊查询(%关键词%
queryChain.like(SimulationJob::getSolverName, req.getSolverName().trim());
}
List<SimulationJob> results = queryChain.list();
PageInfo<SimulationJob> page = new PageInfo<>(results);
return PageUtils.getJsonObjectSdmResponse(results, page);