서버상태, httpclient 수정
This commit is contained in:
@@ -537,9 +537,9 @@ public class InferenceResultDto {
|
||||
}
|
||||
|
||||
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() {
|
||||
@@ -547,6 +547,9 @@ public class InferenceResultDto {
|
||||
if (this.cpu_user + this.cpu_system >= 80) {
|
||||
enumId = "CAUTION";
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system == 0) {
|
||||
enumId = "FAILUR";
|
||||
}
|
||||
return enumId;
|
||||
}
|
||||
|
||||
@@ -555,6 +558,9 @@ public class InferenceResultDto {
|
||||
if (this.gpuUtil >= 80) {
|
||||
enumId = "CAUTION";
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system == 0) {
|
||||
enumId = "FAILUR";
|
||||
}
|
||||
return enumId;
|
||||
}
|
||||
|
||||
@@ -563,6 +569,9 @@ public class InferenceResultDto {
|
||||
if (this.memused >= 80) {
|
||||
enumId = "CAUTION";
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system == 0) {
|
||||
enumId = "FAILUR";
|
||||
}
|
||||
return enumId;
|
||||
}
|
||||
|
||||
@@ -570,6 +579,9 @@ public class InferenceResultDto {
|
||||
if (this.cpu_user + this.cpu_system >= 80) {
|
||||
return ServerStatus.CAUTION.getText();
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system == 0) {
|
||||
return ServerStatus.FAILUR.getText();
|
||||
}
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
@@ -577,6 +589,9 @@ public class InferenceResultDto {
|
||||
if (this.gpuUtil >= 80) {
|
||||
return ServerStatus.CAUTION.getText();
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system == 0) {
|
||||
return ServerStatus.FAILUR.getText();
|
||||
}
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
@@ -584,6 +599,9 @@ public class InferenceResultDto {
|
||||
if (this.memused >= 80) {
|
||||
return ServerStatus.CAUTION.getText();
|
||||
}
|
||||
else if (this.cpu_user + this.cpu_system == 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;
|
||||
@@ -514,7 +517,39 @@ 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=0; 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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
systemMetricEntity.serverName,
|
||||
systemMetricEntity.cpuUser,
|
||||
systemMetricEntity.cpuSystem,
|
||||
systemMetricEntity.memused,
|
||||
systemMetricEntity.kbmemused,
|
||||
gpuMetricEntity.gpuUtil
|
||||
*/
|
||||
//if( dtoList)
|
||||
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user