GPU사용율수정

This commit is contained in:
Moon
2026-01-15 14:49:17 +09:00
parent 901c2d7d11
commit 8af0b2ce60
2 changed files with 10 additions and 14 deletions

View File

@@ -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();

View File

@@ -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<Integer> latestGpuIds =
List<OffsetDateTime> 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 절 사용