From 8af0b2ce6062aed6779af3df8b4178dfba97fe71 Mon Sep 17 00:00:00 2001 From: Moon Date: Thu, 15 Jan 2026 14:49:17 +0900 Subject: [PATCH] =?UTF-8?q?GPU=EC=82=AC=EC=9A=A9=EC=9C=A8=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kamcoback/inference/dto/InferenceResultDto.java | 11 +++-------- .../Inference/MapSheetLearnRepositoryImpl.java | 13 +++++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java index 123ce8d8..b8ea9831 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java @@ -514,8 +514,7 @@ public class InferenceResultDto { @JsonIgnore private float cpu_system; @JsonIgnore private float memused; private Long kbmemused; - @JsonIgnore private float gpuMemUsed; - @JsonIgnore private float gpuMemTotal; + private float gpuUtil; // private String cpuStatusName; // private String memStatusName; @@ -527,9 +526,6 @@ public class InferenceResultDto { public float getCpuUseRate() { return this.cpu_user + this.cpu_system; } - public double getGpuUtil() { - return (this.gpuMemUsed / this.gpuMemTotal ) * 100.0; - } public String getServerStatus() { String enumId = "SAFETY"; @@ -553,8 +549,7 @@ public class InferenceResultDto { public String getGpuStatus() { String enumId = "SAFETY"; - - if (this.getGpuUtil() >= 80L) { + if (this.gpuUtil >= 80) { enumId = "CAUTION"; } return enumId; @@ -576,7 +571,7 @@ public class InferenceResultDto { } public String getGpuStatusName() { - if (this.getGpuUtil() >= 80) { + if (this.gpuUtil >= 80) { return ServerStatus.CAUTION.getText(); } return ServerStatus.SAFETY.getText(); diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryImpl.java index bd63e154..52d13ef8 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryImpl.java @@ -28,6 +28,7 @@ import com.querydsl.core.types.dsl.Expressions; import com.querydsl.core.types.dsl.NumberExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import jakarta.persistence.EntityNotFoundException; +import java.time.OffsetDateTime; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -118,9 +119,9 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto .groupBy(systemMetricEntity.serverName) .fetch(); - List latestGpuIds = + List latestGpuIds = queryFactory - .select(gpuMetricEntity.id1.max()) + .select(gpuMetricEntity.timestamp.max()) .from(gpuMetricEntity) .groupBy(gpuMetricEntity.serverName) .fetch(); @@ -135,15 +136,15 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto systemMetricEntity.cpuSystem, systemMetricEntity.memused, systemMetricEntity.kbmemused, - //gpuMetricEntity.gpuUtil, - gpuMetricEntity.gpuMemUsed, - gpuMetricEntity.gpuMemTotal + gpuMetricEntity.gpuUtil + //gpuMetricEntity.gpuMemUsed, + //gpuMetricEntity.gpuMemTotal )) .from(systemMetricEntity) .leftJoin(gpuMetricEntity) .on( gpuMetricEntity - .id1 + .timestamp .in(latestGpuIds) .and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))) .where(systemMetricEntity.id1.in(latestIds)) // In 절 사용