서버상태 수정

This commit is contained in:
Moon
2026-01-22 13:38:50 +09:00
parent 2999067346
commit f1a673d367
3 changed files with 41 additions and 19 deletions

View File

@@ -538,6 +538,7 @@ 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;
}
@@ -553,7 +554,7 @@ public class InferenceResultDto {
if (this.cpu_user + this.cpu_system >= 80) {
enumId = "CAUTION";
}
else if (this.cpu_user + this.cpu_system == 0) {
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
enumId = "FAILUR";
}
return enumId;
@@ -575,7 +576,7 @@ public class InferenceResultDto {
if (this.memused >= 80) {
enumId = "CAUTION";
}
else if (this.cpu_user + this.cpu_system == 0) {
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
enumId = "FAILUR";
}
return enumId;
@@ -585,7 +586,7 @@ public class InferenceResultDto {
if (this.cpu_user + this.cpu_system >= 80) {
return ServerStatus.CAUTION.getText();
}
else if (this.cpu_user + this.cpu_system == 0) {
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
return ServerStatus.FAILUR.getText();
}
return ServerStatus.SAFETY.getText();
@@ -595,7 +596,7 @@ public class InferenceResultDto {
if (this.gpuUtil >= 80) {
return ServerStatus.CAUTION.getText();
}
else if (this.cpu_user + this.cpu_system == 0) {
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
return ServerStatus.FAILUR.getText();
}
return ServerStatus.SAFETY.getText();
@@ -605,7 +606,7 @@ public class InferenceResultDto {
if (this.memused >= 80) {
return ServerStatus.CAUTION.getText();
}
else if (this.cpu_user + this.cpu_system == 0) {
else if (this.cpu_user + this.cpu_system + this.memused == 0) {
return ServerStatus.FAILUR.getText();
}
return ServerStatus.SAFETY.getText();

View File

@@ -44,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;
@@ -525,7 +526,7 @@ public class InferenceResultService {
if( size == 0 )
{
for(int k=0; k<4; k++)
for(int k=1; k<=4; k++)
{
InferenceServerStatusDto dto = new InferenceServerStatusDto();
dto.setServerName("server0"+k);
@@ -538,16 +539,36 @@ public class InferenceResultService {
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;
}
}
/*
systemMetricEntity.serverName,
systemMetricEntity.cpuUser,
systemMetricEntity.cpuSystem,
systemMetricEntity.memused,
systemMetricEntity.kbmemused,
gpuMetricEntity.gpuUtil
*/
//if( dtoList)
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;
}

View File

@@ -121,8 +121,8 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
queryFactory
.select(systemMetricEntity.timestamp.max())
.from(systemMetricEntity)
//.where(systemMetricEntity.timestamp.goe(OffsetDateTime.now().minusMinutes(5)))
.where(systemMetricEntity.timestamp.goe(OffsetDateTime.now().minusSeconds(30)))
.where(systemMetricEntity.timestamp.goe(OffsetDateTime.now().minusMinutes(5)))
//.where(systemMetricEntity.timestamp.goe(OffsetDateTime.now().minusSeconds(30)))
.groupBy(systemMetricEntity.serverName)
.fetch();
@@ -130,8 +130,8 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
queryFactory
.select(gpuMetricEntity.timestamp.max())
.from(gpuMetricEntity)
//.where(gpuMetricEntity.timestamp.goe(OffsetDateTime.now().minusMinutes(5)))
.where(gpuMetricEntity.timestamp.goe(OffsetDateTime.now().minusSeconds(30)))
.where(gpuMetricEntity.timestamp.goe(OffsetDateTime.now().minusMinutes(5)))
//.where(gpuMetricEntity.timestamp.goe(OffsetDateTime.now().minusSeconds(30)))
.groupBy(gpuMetricEntity.serverName)
.fetch();