서버상태 수정

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

View File

@@ -44,6 +44,7 @@ import jakarta.validation.constraints.NotNull;
import java.nio.file.Path; import java.nio.file.Path;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -525,7 +526,7 @@ public class InferenceResultService {
if( size == 0 ) if( size == 0 )
{ {
for(int k=0; k<4; k++) for(int k=1; k<=4; k++)
{ {
InferenceServerStatusDto dto = new InferenceServerStatusDto(); InferenceServerStatusDto dto = new InferenceServerStatusDto();
dto.setServerName("server0"+k); dto.setServerName("server0"+k);
@@ -538,16 +539,36 @@ public class InferenceResultService {
dtoList.add(dto); 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") )
systemMetricEntity.serverName, {
systemMetricEntity.cpuUser, InferenceServerStatusDto dto = new InferenceServerStatusDto();
systemMetricEntity.cpuSystem, dto.setServerName(srvNm);
systemMetricEntity.memused, dto.setCpu_user(0);
systemMetricEntity.kbmemused, dto.setCpu_system(0);
gpuMetricEntity.gpuUtil dto.setMemused(0);
*/ dto.setKbmemused(0L);
//if( dtoList) dto.setGpuUtil(0);
dtoList.add(dto);
}
}
}
dtoList.sort(Comparator.comparing(InferenceServerStatusDto::getServerName));
return dtoList; return dtoList;
} }

View File

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