修改:HPC job clone,重排队指令结果集处理逻辑新增
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.sdm.common.entity.resp.pbs.hpc;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CloneJobResp {
|
||||
private String jobId;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.sdm.common.entity.resp.pbs.hpc;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class JobRequeueResp {
|
||||
|
||||
private Boolean requeued;
|
||||
|
||||
private String jobId;
|
||||
|
||||
}
|
||||
@@ -522,4 +522,39 @@ public class HpcCommandResulParseUtil {
|
||||
}
|
||||
|
||||
|
||||
public static CloneJobResp parseJobCloneResult(String cmdOutput) {
|
||||
CloneJobResp cloneJobResp = new CloneJobResp();
|
||||
try {
|
||||
// 按逗号分割,然后按冒号分割
|
||||
String[] parts = cmdOutput.split(",");
|
||||
for (String part : parts) {
|
||||
if (part.trim().startsWith("ID:")) {
|
||||
String idStr = part.split(":")[1].trim();
|
||||
cloneJobResp.setJobId(idStr);
|
||||
return cloneJobResp;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CoreLogger.error("parseJobCloneResult error:{}",cmdOutput);
|
||||
}
|
||||
return cloneJobResp;
|
||||
}
|
||||
|
||||
public static JobRequeueResp parseJobRequeue(String cmdOutput) {
|
||||
JobRequeueResp jobRequeueResp = new JobRequeueResp();
|
||||
if (StringUtils.isBlank(cmdOutput)) return jobRequeueResp;
|
||||
String line = cmdOutput.trim();
|
||||
// 正常返回格式:Requeue job #6
|
||||
Pattern p = Pattern.compile("Requeue job #?(\\d+)", Pattern.CASE_INSENSITIVE);
|
||||
Matcher m = p.matcher(line);
|
||||
if (m.find()) {
|
||||
jobRequeueResp.setRequeued(true);
|
||||
String requeuedJobId = m.group(1);
|
||||
jobRequeueResp.setJobId(requeuedJobId);
|
||||
return jobRequeueResp;
|
||||
}
|
||||
jobRequeueResp.setRequeued(false);
|
||||
return jobRequeueResp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user