서버상태(M1~M4)
This commit is contained in:
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||
import com.kamco.cd.kamcoback.inference.service.InferenceResultService;
|
||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
||||
@@ -217,4 +218,23 @@ public class InferenceResultApiController {
|
||||
// inferenceResultService.getInferenceResultGeomList(id, searchGeoReq);
|
||||
// return ApiResponseDto.ok(geomList);
|
||||
// }
|
||||
|
||||
@Operation(summary = "추론관리 추론진행 서버 현황", description = "추론관리 추론진행 서버 현황")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "검색 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Page.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/serverStatus")
|
||||
public ApiResponseDto<List<InferenceServerStatusDto>> getInferenceServerStatusList() {
|
||||
|
||||
return ApiResponseDto.ok(inferenceResultService.getInferenceServerStatusList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.inference.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.EnumValid;
|
||||
@@ -196,4 +197,107 @@ public class InferenceResultDto {
|
||||
private String mapSheetNum;
|
||||
private String mapSheetName;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class InferenceServerStatusDto {
|
||||
|
||||
private String serverName;
|
||||
@JsonIgnore
|
||||
private float cpu_user;
|
||||
@JsonIgnore private float cpu_system;
|
||||
@JsonIgnore private float memused;
|
||||
private Long kbmemused;
|
||||
private float gpuUtil;
|
||||
//private String cpuStatusName;
|
||||
//private String memStatusName;
|
||||
//private String gpuStatusName;
|
||||
//private float cpu_use_rate;
|
||||
//private float gpu_use_rate;
|
||||
//private float mem_use_rate;
|
||||
|
||||
public float getCpuUseRate()
|
||||
{
|
||||
return this.cpu_user+this.cpu_system;
|
||||
}
|
||||
|
||||
public String getServerStatus()
|
||||
{
|
||||
String enumId = "SAFETY";
|
||||
//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();
|
||||
}
|
||||
|
||||
public String getCpuStatus()
|
||||
{
|
||||
String enumId = "SAFETY";
|
||||
if( this.cpu_user+this.cpu_system >= 80 )enumId = "CAUTION";
|
||||
return enumId;
|
||||
}
|
||||
|
||||
public String getGpuStatus()
|
||||
{
|
||||
String enumId = "SAFETY";
|
||||
if( this.gpuUtil >= 80 )enumId = "CAUTION";
|
||||
return enumId;
|
||||
}
|
||||
|
||||
public String getMemStatus()
|
||||
{
|
||||
String enumId = "SAFETY";
|
||||
if( this.memused >= 80 )enumId = "CAUTION";
|
||||
return enumId;
|
||||
}
|
||||
|
||||
public String getCpuStatusName()
|
||||
{
|
||||
if( this.cpu_user+this.cpu_system >= 80 )return ServerStatus.CAUTION.getText();
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
public String getGpuStatusName()
|
||||
{
|
||||
if( this.gpuUtil >= 80 )return ServerStatus.CAUTION.getText();
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
public String getMemStatusName()
|
||||
{
|
||||
if( this.memused >= 80 )return ServerStatus.CAUTION.getText();
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ServerStatus implements EnumType {
|
||||
SAFETY("원활"),
|
||||
CAUTION("주의"),
|
||||
FAILUR("장애"),
|
||||
;
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Detail;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.MapSheet;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetNumDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||
@@ -361,4 +362,8 @@ public class InferenceResultService {
|
||||
public List<MapSheet> listGetScenes5k(Long id) {
|
||||
return inferenceResultCoreService.listGetScenes5k(id);
|
||||
}
|
||||
|
||||
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
||||
return inferenceResultCoreService.getInferenceServerStatusList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user