修改:HPC 操作类型指令增加操作失败的逻辑
This commit is contained in:
@@ -9,6 +9,7 @@ import com.sdm.common.utils.HpcCommandExcuteUtil;
|
||||
import com.sdm.common.utils.HpcCommandResulParseUtil;
|
||||
import com.sdm.pbs.service.TaskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -80,6 +82,10 @@ public class TaskServiceImpl implements TaskService {
|
||||
NewJobResp newJobResp = HpcCommandResulParseUtil.parseJobNewResult(result);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("hpcCommand", newJobCommand);
|
||||
if(Objects.isNull(newJobResp)|| StringUtils.isBlank(newJobResp.getJobId())){
|
||||
map.put("errMsg", result);
|
||||
return SdmResponse.failed(map);
|
||||
}
|
||||
map.put("result", newJobResp);
|
||||
return SdmResponse.success(map);
|
||||
}
|
||||
@@ -94,6 +100,10 @@ public class TaskServiceImpl implements TaskService {
|
||||
AddJobResp addJobResp = HpcCommandResulParseUtil.parseJoAddResult(result);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("hpcCommand", addJobCommand);
|
||||
if(Objects.isNull(addJobResp)||StringUtils.isBlank(addJobResp.getTsakId())){
|
||||
map.put("errMsg", result);
|
||||
return SdmResponse.failed(map);
|
||||
}
|
||||
map.put("result", addJobResp);
|
||||
return SdmResponse.success(map);
|
||||
}
|
||||
@@ -109,6 +119,10 @@ public class TaskServiceImpl implements TaskService {
|
||||
submitHpcJobResp.setJobId(req.getId());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("hpcCommand", submitJobCommand);
|
||||
if(Objects.isNull(submitHpcJobResp)||Objects.equals(false,submitHpcJobResp.getSubmit())){
|
||||
map.put("errMsg", result);
|
||||
return SdmResponse.failed(map);
|
||||
}
|
||||
map.put("result", submitHpcJobResp);
|
||||
return SdmResponse.success(map);
|
||||
}
|
||||
@@ -123,6 +137,10 @@ public class TaskServiceImpl implements TaskService {
|
||||
JobCancelResp jobCancelResp = HpcCommandResulParseUtil.parseJobCancel(result);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("hpcCommand", cancelJobCommand);
|
||||
if(Objects.isNull(jobCancelResp)||Objects.equals(false,jobCancelResp.getCanceled())){
|
||||
map.put("errMsg", result);
|
||||
return SdmResponse.failed(map);
|
||||
}
|
||||
map.put("result", jobCancelResp);
|
||||
return SdmResponse.success(map);
|
||||
}
|
||||
@@ -137,6 +155,10 @@ public class TaskServiceImpl implements TaskService {
|
||||
CloneJobResp cloneJobResp = HpcCommandResulParseUtil.parseJobCloneResult(result);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("hpcCommand", cloneJobCommand);
|
||||
if(Objects.isNull(cloneJobResp)||StringUtils.isBlank(cloneJobResp.getJobId())){
|
||||
map.put("errMsg", result);
|
||||
return SdmResponse.failed(map);
|
||||
}
|
||||
map.put("result", cloneJobResp);
|
||||
return SdmResponse.success(map);
|
||||
}
|
||||
@@ -151,6 +173,10 @@ public class TaskServiceImpl implements TaskService {
|
||||
JobFinishResp jobFinishResp = HpcCommandResulParseUtil.parseJobFinish(result);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("hpcCommand", finishJobCommand);
|
||||
if(Objects.isNull(jobFinishResp)||Objects.equals(false,jobFinishResp.getFinished())){
|
||||
map.put("errMsg", result);
|
||||
return SdmResponse.failed(map);
|
||||
}
|
||||
map.put("result", jobFinishResp);
|
||||
return SdmResponse.success(map);
|
||||
}
|
||||
@@ -193,6 +219,10 @@ public class TaskServiceImpl implements TaskService {
|
||||
JobModifyResp jobModifyResp = HpcCommandResulParseUtil.parseJobModify(result);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("hpcCommand", modifyJobCommand);
|
||||
if(Objects.isNull(jobModifyResp)||Objects.equals(false,jobModifyResp.getModified())){
|
||||
map.put("errMsg", result);
|
||||
return SdmResponse.failed(map);
|
||||
}
|
||||
map.put("result", jobModifyResp);
|
||||
return SdmResponse.success(map);
|
||||
}
|
||||
@@ -207,6 +237,10 @@ public class TaskServiceImpl implements TaskService {
|
||||
JobRequeueResp jobRequeueResp = HpcCommandResulParseUtil.parseJobRequeue(result);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("hpcCommand", requeueJobCommand);
|
||||
if(Objects.isNull(jobRequeueResp)||Objects.equals(false,jobRequeueResp.getRequeued())){
|
||||
map.put("errMsg", result);
|
||||
return SdmResponse.failed(map);
|
||||
}
|
||||
map.put("result", jobRequeueResp);
|
||||
return SdmResponse.success(map);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user