Merge remote-tracking branch 'origin/main'

This commit is contained in:
2025-11-18 11:42:36 +08:00
5 changed files with 96 additions and 4 deletions

View File

@@ -0,0 +1,8 @@
package com.sdm.common.entity.resp.pbs.hpc;
import lombok.Data;
@Data
public class CloneJobResp {
private String jobId;
}

View File

@@ -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;
}

View File

@@ -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;
}
}