This commit is contained in:
2026-01-12 21:08:34 +09:00
parent 7a2a6896d8
commit b4ad2fb858
7 changed files with 97 additions and 96 deletions

View File

@@ -260,7 +260,7 @@ public class InferenceResultCoreService {
return inferenceBatchSheet;
}
public InferenceStatusDetailDto getInferenceStatus(UUID uuid){
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
return mapSheetLearnRepository.getInferenceStatus(uuid);
}
}

View File

@@ -1,13 +1,12 @@
package com.kamco.cd.kamcoback.postgres.repository.Inference;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
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.InferenceStatusDetailDto;
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 {

View File

@@ -2,11 +2,9 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference;
import static com.kamco.cd.kamcoback.postgres.entity.QGpuMetricEntity.gpuMetricEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity.modelMngEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QSystemMetricEntity.systemMetricEntity;
import com.kamco.cd.kamcoback.common.utils.DateRange;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
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.InferenceStatusDetailDto;
@@ -100,35 +98,42 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
BooleanBuilder builder = new BooleanBuilder();
List<Integer> latestIds = queryFactory
.select(systemMetricEntity.id1.max())
.from(systemMetricEntity)
.groupBy(systemMetricEntity.serverName)
.fetch();
List<Integer> latestIds =
queryFactory
.select(systemMetricEntity.id1.max())
.from(systemMetricEntity)
.groupBy(systemMetricEntity.serverName)
.fetch();
List<Integer> latestGpuIds = queryFactory
.select(gpuMetricEntity.id1.max())
.from(gpuMetricEntity)
.groupBy(gpuMetricEntity.serverName)
.fetch();
List<Integer> latestGpuIds =
queryFactory
.select(gpuMetricEntity.id1.max())
.from(gpuMetricEntity)
.groupBy(gpuMetricEntity.serverName)
.fetch();
List<InferenceServerStatusDto> foundContent = queryFactory
.select(Projections.constructor(
InferenceServerStatusDto.class,
systemMetricEntity.serverName,
systemMetricEntity.cpuUser,
systemMetricEntity.cpuSystem,
systemMetricEntity.memused,
systemMetricEntity.kbmemused,
gpuMetricEntity.gpuUtil
))
.from(systemMetricEntity)
.leftJoin(gpuMetricEntity).on(gpuMetricEntity.id1.in(latestGpuIds)
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
.orderBy(systemMetricEntity.serverName.asc())
.limit(4)
.fetch();
List<InferenceServerStatusDto> foundContent =
queryFactory
.select(
Projections.constructor(
InferenceServerStatusDto.class,
systemMetricEntity.serverName,
systemMetricEntity.cpuUser,
systemMetricEntity.cpuSystem,
systemMetricEntity.memused,
systemMetricEntity.kbmemused,
gpuMetricEntity.gpuUtil))
.from(systemMetricEntity)
.leftJoin(gpuMetricEntity)
.on(
gpuMetricEntity
.id1
.in(latestGpuIds)
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
.orderBy(systemMetricEntity.serverName.asc())
.limit(4)
.fetch();
return foundContent;
}
@@ -142,29 +147,32 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
QModelMngEntity m2Model = new QModelMngEntity("m2Model");
QModelMngEntity m3Model = new QModelMngEntity("m3Model");
InferenceStatusDetailDto foundContent = queryFactory
.select(Projections.constructor(
InferenceStatusDetailDto.class,
mapSheetLearnEntity.title,
mapSheetLearnEntity.compareYyyy,
mapSheetLearnEntity.targetYyyy,
mapSheetLearnEntity.detectOption,
mapSheetLearnEntity.mapSheetScope,
mapSheetLearnEntity.inferStartDttm,
mapSheetLearnEntity.inferEndDttm,
mapSheetLearnEntity.detectingCnt,
m1Model.modelVer.as("model1Ver"),
m2Model.modelVer.as("model2Ver"),
m3Model.modelVer.as("model3Ver")
))
.from(mapSheetLearnEntity)
.leftJoin(m1Model).on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid))
.leftJoin(m2Model).on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid))
.leftJoin(m3Model).on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid))
.where(mapSheetLearnEntity.uuid.eq(uuid))
.fetchOne();
InferenceStatusDetailDto foundContent =
queryFactory
.select(
Projections.constructor(
InferenceStatusDetailDto.class,
mapSheetLearnEntity.title,
mapSheetLearnEntity.compareYyyy,
mapSheetLearnEntity.targetYyyy,
mapSheetLearnEntity.detectOption,
mapSheetLearnEntity.mapSheetScope,
mapSheetLearnEntity.inferStartDttm,
mapSheetLearnEntity.inferEndDttm,
mapSheetLearnEntity.detectingCnt,
m1Model.modelVer.as("model1Ver"),
m2Model.modelVer.as("model2Ver"),
m3Model.modelVer.as("model3Ver")))
.from(mapSheetLearnEntity)
.leftJoin(m1Model)
.on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid))
.leftJoin(m2Model)
.on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid))
.leftJoin(m3Model)
.on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid))
.where(mapSheetLearnEntity.uuid.eq(uuid))
.fetchOne();
return foundContent;
}
}