Merge pull request 'spotless' (#202) from feat/infer_dev_260107 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/202
This commit is contained in:
@@ -205,12 +205,12 @@ public class InferenceResultDto {
|
||||
public static class InferenceServerStatusDto {
|
||||
|
||||
private String serverName;
|
||||
@JsonIgnore
|
||||
private float cpu_user;
|
||||
@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;
|
||||
@@ -218,68 +218,56 @@ public class InferenceResultDto {
|
||||
// private float gpu_use_rate;
|
||||
// private float mem_use_rate;
|
||||
|
||||
public float getCpuUseRate()
|
||||
{
|
||||
public float getCpuUseRate() {
|
||||
return this.cpu_user + this.cpu_system;
|
||||
}
|
||||
|
||||
public String getServerStatus()
|
||||
{
|
||||
public String getServerStatus() {
|
||||
String enumId = "SAFETY";
|
||||
// if( this.cpu_user+this.cpu_system >= 80 )enumId = "CAUTION";
|
||||
return enumId;
|
||||
}
|
||||
|
||||
public String getServerStatusName()
|
||||
{
|
||||
public String getServerStatusName() {
|
||||
// String enumId = "SAFETY";
|
||||
// if( this.cpu_user+this.cpu_system >= 80 )enumId = "CAUTION";
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
public String getCpuStatus()
|
||||
{
|
||||
public String getCpuStatus() {
|
||||
String enumId = "SAFETY";
|
||||
if (this.cpu_user + this.cpu_system >= 80) enumId = "CAUTION";
|
||||
return enumId;
|
||||
}
|
||||
|
||||
public String getGpuStatus()
|
||||
{
|
||||
public String getGpuStatus() {
|
||||
String enumId = "SAFETY";
|
||||
if (this.gpuUtil >= 80) enumId = "CAUTION";
|
||||
return enumId;
|
||||
}
|
||||
|
||||
public String getMemStatus()
|
||||
{
|
||||
public String getMemStatus() {
|
||||
String enumId = "SAFETY";
|
||||
if (this.memused >= 80) enumId = "CAUTION";
|
||||
return enumId;
|
||||
}
|
||||
|
||||
public String getCpuStatusName()
|
||||
{
|
||||
public String getCpuStatusName() {
|
||||
if (this.cpu_user + this.cpu_system >= 80) return ServerStatus.CAUTION.getText();
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
public String getGpuStatusName()
|
||||
{
|
||||
public String getGpuStatusName() {
|
||||
if (this.gpuUtil >= 80) return ServerStatus.CAUTION.getText();
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
public String getMemStatusName()
|
||||
{
|
||||
public String getMemStatusName() {
|
||||
if (this.memused >= 80) return ServerStatus.CAUTION.getText();
|
||||
return ServerStatus.SAFETY.getText();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ServerStatus implements EnumType {
|
||||
|
||||
@@ -228,6 +228,7 @@ public class InferenceResultCoreService {
|
||||
entity.setStatus(status);
|
||||
}
|
||||
|
||||
public List<InferenceServerStatusDto> getInferenceServerStatusList(){return mapSheetLearnRepository.getInferenceServerStatusList();
|
||||
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
||||
return mapSheetLearnRepository.getInferenceServerStatusList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,5 +44,4 @@ public class GpuMetricEntity {
|
||||
|
||||
@Column(name = "gpu_mem_total")
|
||||
private Float gpuMemTotal;
|
||||
|
||||
}
|
||||
|
||||
@@ -55,5 +55,4 @@ public class SystemMetricEntity {
|
||||
|
||||
@Column(name = "memused")
|
||||
private Float memused;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.List;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface MapSheetLearnRepositoryCustom {
|
||||
|
||||
@@ -94,30 +94,34 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
List<Integer> latestIds = queryFactory
|
||||
List<Integer> latestIds =
|
||||
queryFactory
|
||||
.select(systemMetricEntity.id1.max())
|
||||
.from(systemMetricEntity)
|
||||
.groupBy(systemMetricEntity.serverName)
|
||||
.fetch();
|
||||
|
||||
List<Integer> latestGpuIds = queryFactory
|
||||
List<Integer> latestGpuIds =
|
||||
queryFactory
|
||||
.select(gpuMetricEntity.id1.max())
|
||||
.from(gpuMetricEntity)
|
||||
.groupBy(gpuMetricEntity.serverName)
|
||||
.fetch();
|
||||
|
||||
List<InferenceServerStatusDto> foundContent = queryFactory
|
||||
.select(Projections.constructor(
|
||||
List<InferenceServerStatusDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceServerStatusDto.class,
|
||||
systemMetricEntity.serverName,
|
||||
systemMetricEntity.cpuUser,
|
||||
systemMetricEntity.cpuSystem,
|
||||
systemMetricEntity.memused,
|
||||
systemMetricEntity.kbmemused,
|
||||
gpuMetricEntity.gpuUtil
|
||||
))
|
||||
gpuMetricEntity.gpuUtil))
|
||||
.from(systemMetricEntity)
|
||||
.leftJoin(gpuMetricEntity).on(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))
|
||||
.leftJoin(gpuMetricEntity)
|
||||
.on(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))
|
||||
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
|
||||
.orderBy(systemMetricEntity.serverName.asc())
|
||||
.limit(4)
|
||||
|
||||
Reference in New Issue
Block a user