GPU사용율수정
This commit is contained in:
@@ -514,8 +514,7 @@ public class InferenceResultDto {
|
|||||||
@JsonIgnore private float cpu_system;
|
@JsonIgnore private float cpu_system;
|
||||||
@JsonIgnore private float memused;
|
@JsonIgnore private float memused;
|
||||||
private Long kbmemused;
|
private Long kbmemused;
|
||||||
@JsonIgnore private float gpuMemUsed;
|
private float gpuUtil;
|
||||||
@JsonIgnore private float gpuMemTotal;
|
|
||||||
|
|
||||||
// private String cpuStatusName;
|
// private String cpuStatusName;
|
||||||
// private String memStatusName;
|
// private String memStatusName;
|
||||||
@@ -527,9 +526,6 @@ public class InferenceResultDto {
|
|||||||
public float getCpuUseRate() {
|
public float getCpuUseRate() {
|
||||||
return this.cpu_user + this.cpu_system;
|
return this.cpu_user + this.cpu_system;
|
||||||
}
|
}
|
||||||
public double getGpuUtil() {
|
|
||||||
return (this.gpuMemUsed / this.gpuMemTotal ) * 100.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getServerStatus() {
|
public String getServerStatus() {
|
||||||
String enumId = "SAFETY";
|
String enumId = "SAFETY";
|
||||||
@@ -553,8 +549,7 @@ public class InferenceResultDto {
|
|||||||
|
|
||||||
public String getGpuStatus() {
|
public String getGpuStatus() {
|
||||||
String enumId = "SAFETY";
|
String enumId = "SAFETY";
|
||||||
|
if (this.gpuUtil >= 80) {
|
||||||
if (this.getGpuUtil() >= 80L) {
|
|
||||||
enumId = "CAUTION";
|
enumId = "CAUTION";
|
||||||
}
|
}
|
||||||
return enumId;
|
return enumId;
|
||||||
@@ -576,7 +571,7 @@ public class InferenceResultDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getGpuStatusName() {
|
public String getGpuStatusName() {
|
||||||
if (this.getGpuUtil() >= 80) {
|
if (this.gpuUtil >= 80) {
|
||||||
return ServerStatus.CAUTION.getText();
|
return ServerStatus.CAUTION.getText();
|
||||||
}
|
}
|
||||||
return ServerStatus.SAFETY.getText();
|
return ServerStatus.SAFETY.getText();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.querydsl.core.types.dsl.Expressions;
|
|||||||
import com.querydsl.core.types.dsl.NumberExpression;
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.persistence.EntityNotFoundException;
|
import jakarta.persistence.EntityNotFoundException;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -118,9 +119,9 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
.groupBy(systemMetricEntity.serverName)
|
.groupBy(systemMetricEntity.serverName)
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
List<Integer> latestGpuIds =
|
List<OffsetDateTime> latestGpuIds =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(gpuMetricEntity.id1.max())
|
.select(gpuMetricEntity.timestamp.max())
|
||||||
.from(gpuMetricEntity)
|
.from(gpuMetricEntity)
|
||||||
.groupBy(gpuMetricEntity.serverName)
|
.groupBy(gpuMetricEntity.serverName)
|
||||||
.fetch();
|
.fetch();
|
||||||
@@ -135,15 +136,15 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
systemMetricEntity.cpuSystem,
|
systemMetricEntity.cpuSystem,
|
||||||
systemMetricEntity.memused,
|
systemMetricEntity.memused,
|
||||||
systemMetricEntity.kbmemused,
|
systemMetricEntity.kbmemused,
|
||||||
//gpuMetricEntity.gpuUtil,
|
gpuMetricEntity.gpuUtil
|
||||||
gpuMetricEntity.gpuMemUsed,
|
//gpuMetricEntity.gpuMemUsed,
|
||||||
gpuMetricEntity.gpuMemTotal
|
//gpuMetricEntity.gpuMemTotal
|
||||||
))
|
))
|
||||||
.from(systemMetricEntity)
|
.from(systemMetricEntity)
|
||||||
.leftJoin(gpuMetricEntity)
|
.leftJoin(gpuMetricEntity)
|
||||||
.on(
|
.on(
|
||||||
gpuMetricEntity
|
gpuMetricEntity
|
||||||
.id1
|
.timestamp
|
||||||
.in(latestGpuIds)
|
.in(latestGpuIds)
|
||||||
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
|
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
|
||||||
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
|
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
|
||||||
|
|||||||
Reference in New Issue
Block a user