修改:Hpc节点资源增加可用节点总数

This commit is contained in:
2026-02-11 15:25:36 +08:00
parent b66b81e15f
commit cb74c4a077
2 changed files with 12 additions and 1 deletions

View File

@@ -9,6 +9,12 @@ import java.util.List;
@Data
public class HpcResouceInfo {
@Schema(description = "资源总数")
public int totalNodes;
@Schema(description = "资源可用数")
public int freeNodes;
@Schema(description = "资源总核数")
public int totalCores;

View File

@@ -147,8 +147,10 @@ public class IPbsHpcServiceImpl implements IPbsService {
int totalCores = 0;
int usedCores = 0;
int freeCoresSum = 0;
int totalNodes=0;
int freeNodes=0;
List<HpcNodeInfo> nodeInfos = new ArrayList<>(nodes.size());
totalNodes = nodes.size();
for (NodeList node : nodes) {
if (node == null) {
continue;
@@ -166,6 +168,7 @@ public class IPbsHpcServiceImpl implements IPbsService {
totalCores += max;
usedCores += run;
freeCoresSum += free;
freeNodes=freeNodes+1;
}
nodeInfos.add(info);
}
@@ -173,6 +176,8 @@ public class IPbsHpcServiceImpl implements IPbsService {
result.setUsedCores(usedCores);
result.setFreeCores(freeCoresSum);
result.setNodeList(nodeInfos);
result.setTotalNodes(totalNodes);
result.setFreeNodes(freeNodes);
return result;
}