新增:hpc任务批量删除
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.sdm.common.entity.resp.pbs.hpc;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DelHpcJobsResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<String> succJobIds;
|
||||
|
||||
private List<String> failedJobIds;
|
||||
|
||||
}
|
||||
@@ -4,12 +4,15 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.pbs.DelHpcJobsFileToolReq;
|
||||
import com.sdm.common.entity.resp.pbs.hpc.DelHpcJobsResult;
|
||||
import com.sdm.common.entity.resp.pbs.hpc.FileNodeInfo;
|
||||
import com.sdm.common.log.CoreLogger;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DataBufferUtils;
|
||||
@@ -55,6 +58,9 @@ public class HpcCommandExcuteUtil {
|
||||
@Value("${hpc.callHpcUpload:}")
|
||||
private String callHpcUpload;
|
||||
|
||||
@Value("${hpc.delHpcJobsUrl:}")
|
||||
private String delHpcJobsUrl;
|
||||
|
||||
@Autowired
|
||||
private HttpClientUtil httpClientUtil;
|
||||
|
||||
@@ -239,4 +245,20 @@ public class HpcCommandExcuteUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public SdmResponse<DelHpcJobsResult> batchDeleteHpcJobs(List<DelHpcJobsFileToolReq> reqs,WebClient pbsWebClient) {
|
||||
// 发起POST请求,同步阻塞获取响应
|
||||
try {
|
||||
SdmResponse<DelHpcJobsResult> response = pbsWebClient.post()
|
||||
.uri(delHpcJobsUrl)
|
||||
.bodyValue(reqs) // 传入请求体对象
|
||||
.retrieve()
|
||||
.bodyToMono(new ParameterizedTypeReference<SdmResponse<DelHpcJobsResult>>() {}) // 泛型类型指定
|
||||
.block(); // 阻塞等待响应
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("batchDeleteHpcJobs post error:{}",e.getMessage());
|
||||
return SdmResponse.failed("发起批量删除hpc节点工作目录异常");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user