Merge remote-tracking branch 'origin/feat/infer_dev_260107' into feat/infer_dev_260107
This commit is contained in:
@@ -538,14 +538,15 @@ public class InferenceResultDto {
|
||||
|
||||
public String getServerStatus() {
|
||||
String enumId = "SAFETY";
|
||||
if( this.cpu_user+this.cpu_system+this.gpuUtil+this.kbmemused == 0 )enumId = "FAILUR";
|
||||
// if( this.cpu_user+this.cpu_system >= 80 )enumId = "CAUTION";
|
||||
return enumId;
|
||||
}
|
||||
|
||||
public String getServerStatusName() {
|
||||
// String enumId = "SAFETY";
|
||||
// if( this.cpu_user+this.cpu_system >= 80 )enumId = "CAUTION";
|
||||
return ServerStatus.SAFETY.getText();
|
||||
String enumStr = ServerStatus.SAFETY.getText();
|
||||
if( this.cpu_user+this.cpu_system+this.gpuUtil+this.kbmemused == 0 )enumStr = ServerStatus.FAILUR.getText();
|
||||
return enumStr;
|
||||
}
|
||||
|
||||
public String getCpuStatus() {
|
||||
@@ -553,6 +554,9 @@ public class InferenceResultDto {
|
||||
if (this.cpu_user + this.cpu_system >= 80) {
|
||||
enumId = "CAUTION";
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
|
||||
enumId = "FAILUR";
|
||||
}
|
||||
return enumId;
|
||||
}
|
||||
|
||||
@@ -561,6 +565,9 @@ public class InferenceResultDto {
|
||||
if (this.gpuUtil >= 80) {
|
||||
enumId = "CAUTION";
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system == 0) {
|
||||
enumId = "FAILUR";
|
||||
}
|
||||
return enumId;
|
||||
}
|
||||
|
||||
@@ -569,6 +576,9 @@ public class InferenceResultDto {
|
||||
if (this.memused >= 80) {
|
||||
enumId = "CAUTION";
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
|
||||
enumId = "FAILUR";
|
||||
}
|
||||
return enumId;
|
||||
}
|
||||
|
||||
@@ -576,6 +586,9 @@ public class InferenceResultDto {
|
||||
if (this.cpu_user + this.cpu_system >= 80) {
|
||||
return ServerStatus.CAUTION.getText();
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
|
||||
return ServerStatus.FAILUR.getText();
|
||||
}
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
@@ -583,6 +596,9 @@ public class InferenceResultDto {
|
||||
if (this.gpuUtil >= 80) {
|
||||
return ServerStatus.CAUTION.getText();
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
|
||||
return ServerStatus.FAILUR.getText();
|
||||
}
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
@@ -590,6 +606,9 @@ public class InferenceResultDto {
|
||||
if (this.memused >= 80) {
|
||||
return ServerStatus.CAUTION.getText();
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
|
||||
return ServerStatus.FAILUR.getText();
|
||||
}
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.kamco.cd.kamcoback.inference.service;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QGpuMetricEntity.gpuMetricEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QSystemMetricEntity.systemMetricEntity;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -41,6 +44,7 @@ import jakarta.validation.constraints.NotNull;
|
||||
import java.nio.file.Path;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -514,7 +518,59 @@ public class InferenceResultService {
|
||||
}
|
||||
|
||||
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
||||
return inferenceResultCoreService.getInferenceServerStatusList();
|
||||
|
||||
List<InferenceServerStatusDto> dtoList = inferenceResultCoreService.getInferenceServerStatusList();
|
||||
int size = dtoList.size();
|
||||
|
||||
System.out.println("size ="+size);
|
||||
|
||||
if( size == 0 )
|
||||
{
|
||||
for(int k=1; k<=4; k++)
|
||||
{
|
||||
InferenceServerStatusDto dto = new InferenceServerStatusDto();
|
||||
dto.setServerName("server0"+k);
|
||||
dto.setCpu_user(0);
|
||||
dto.setCpu_system(0);
|
||||
dto.setMemused(0);
|
||||
dto.setKbmemused(0L);
|
||||
dto.setGpuUtil(0);
|
||||
|
||||
dtoList.add(dto);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int k=1; k<=4; k++)
|
||||
{
|
||||
String srvNm = "server"+k;
|
||||
String srvNmChk = "N";
|
||||
for (InferenceServerStatusDto dto : dtoList) {
|
||||
if( srvNm.equals(dto.getServerName()) ){
|
||||
srvNmChk = "Y";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( srvNmChk.equals("N") )
|
||||
{
|
||||
InferenceServerStatusDto dto = new InferenceServerStatusDto();
|
||||
dto.setServerName(srvNm);
|
||||
dto.setCpu_user(0);
|
||||
dto.setCpu_system(0);
|
||||
dto.setMemused(0);
|
||||
dto.setKbmemused(0L);
|
||||
dto.setGpuUtil(0);
|
||||
dtoList.add(dto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dtoList.sort(Comparator.comparing(InferenceServerStatusDto::getServerName));
|
||||
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user