Merge remote-tracking branch 'origin/feat/infer_dev_260107' into feat/infer_dev_260107
# Conflicts: # src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java # src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryCustom.java
This commit is contained in:
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.inference;
|
|||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
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.InferenceServerStatusDto;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||||
import com.kamco.cd.kamcoback.inference.service.InferenceResultService;
|
import com.kamco.cd.kamcoback.inference.service.InferenceResultService;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
||||||
@@ -23,6 +24,7 @@ import java.util.UUID;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -237,4 +239,28 @@ public class InferenceResultApiController {
|
|||||||
|
|
||||||
return ApiResponseDto.ok(inferenceResultService.getInferenceServerStatusList());
|
return ApiResponseDto.ok(inferenceResultService.getInferenceServerStatusList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "추론관리 진행현황 상세", description = "어드민 홈 > 추론관리 > 추론관리 > 진행현황 상세")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "검색 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Page.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping("/status/{uuid}")
|
||||||
|
public ApiResponseDto<InferenceStatusDetailDto> getInferenceStatus(
|
||||||
|
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||||
|
description = "모델 삭제 요청 정보",
|
||||||
|
required = true)
|
||||||
|
@PathVariable
|
||||||
|
UUID uuid) {
|
||||||
|
|
||||||
|
return ApiResponseDto.ok(inferenceResultService.getInferenceStatus(uuid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,6 +195,69 @@ public class InferenceResultDto {
|
|||||||
private String mapSheetName;
|
private String mapSheetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class InferenceStatusDetailDto {
|
||||||
|
private String title;
|
||||||
|
private Integer compareYyyy;
|
||||||
|
private Integer targetYyyy;
|
||||||
|
private String detectOption;
|
||||||
|
private String mapSheetScope;
|
||||||
|
@JsonFormatDttm private ZonedDateTime inferStartDttm;
|
||||||
|
@JsonFormatDttm private ZonedDateTime inferEndDttm;
|
||||||
|
private Long detectingCnt;
|
||||||
|
|
||||||
|
private String model1Ver;
|
||||||
|
private String model2Ver;
|
||||||
|
private String model3Ver;
|
||||||
|
|
||||||
|
public InferenceStatusDetailDto(
|
||||||
|
String title,
|
||||||
|
Integer compareYyyy,
|
||||||
|
Integer targetYyyy,
|
||||||
|
String detectOption,
|
||||||
|
String mapSheetScope,
|
||||||
|
ZonedDateTime inferStartDttm,
|
||||||
|
ZonedDateTime inferEndDttm,
|
||||||
|
Long detectingCnt,
|
||||||
|
String model1Ver,
|
||||||
|
String model2Ver,
|
||||||
|
String model3Ver) {
|
||||||
|
this.title = title;
|
||||||
|
this.compareYyyy = compareYyyy;
|
||||||
|
this.targetYyyy = targetYyyy;
|
||||||
|
this.detectOption = detectOption;
|
||||||
|
this.mapSheetScope = mapSheetScope;
|
||||||
|
this.inferStartDttm = inferStartDttm;
|
||||||
|
this.inferEndDttm = inferEndDttm;
|
||||||
|
this.detectingCnt = detectingCnt;
|
||||||
|
this.model1Ver = model1Ver;
|
||||||
|
this.model2Ver = model2Ver;
|
||||||
|
this.model3Ver = model3Ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String usedServerName;
|
||||||
|
private Long detectingEndCnt = 7L;
|
||||||
|
private String model1VerStatus = "PROCCESING";
|
||||||
|
private String model1VerStatusName = "진행중";
|
||||||
|
private String model2VerStatus = "PROCCESING";
|
||||||
|
private String model2VerStatusName = "진행중";
|
||||||
|
private String model3VerStatus = "PROCCESING";
|
||||||
|
private String model4VerStatusName = "진행중";
|
||||||
|
|
||||||
|
public String getDetectOptionName() {
|
||||||
|
if (this.detectOption.equals("EXCL")) return "추론제외";
|
||||||
|
return "이전 년도 도엽 사용";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMapSheetScopeName() {
|
||||||
|
if (this.detectOption.equals("ALL")) return "전체";
|
||||||
|
return "부분";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.MapSheet;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetNumDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetNumDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||||
@@ -403,4 +404,21 @@ public class InferenceResultService {
|
|||||||
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
||||||
return inferenceResultCoreService.getInferenceServerStatusList();
|
return inferenceResultCoreService.getInferenceServerStatusList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
||||||
|
|
||||||
|
List<InferenceServerStatusDto> servers =
|
||||||
|
inferenceResultCoreService.getInferenceServerStatusList();
|
||||||
|
|
||||||
|
String serverNames = "";
|
||||||
|
for (InferenceServerStatusDto server : servers) {
|
||||||
|
if (serverNames.equals("")) serverNames = server.getServerName();
|
||||||
|
else serverNames = serverNames + "," + server.getServerName();
|
||||||
|
}
|
||||||
|
|
||||||
|
InferenceStatusDetailDto dto = inferenceResultCoreService.getInferenceStatus(uuid);
|
||||||
|
dto.setUsedServerName(serverNames);
|
||||||
|
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,23 @@ public class ModelMngService {
|
|||||||
addReq.setUuid(uuid);
|
addReq.setUuid(uuid);
|
||||||
addReq.setClsModelVersion(addReq.getModelVer());
|
addReq.setClsModelVersion(addReq.getModelVer());
|
||||||
addReq.setPriority(0d);
|
addReq.setPriority(0d);
|
||||||
|
|
||||||
|
ModelUploadResDto modelUploadResDto = new ModelUploadResDto();
|
||||||
|
try {
|
||||||
|
FIleChecker.unzip(addReq.getFileName(), addReq.getFilePath());
|
||||||
|
this.getUnzipModelFiles(addReq.getFilePath(), modelUploadResDto);
|
||||||
|
|
||||||
|
addReq.setCdModelPath(modelUploadResDto.getCdModelPath());
|
||||||
|
addReq.setCdModelFileName(modelUploadResDto.getCdModelFileName());
|
||||||
|
addReq.setCdModelConfigPath(modelUploadResDto.getCdModelConfigPath());
|
||||||
|
addReq.setCdModelConfigFileName(modelUploadResDto.getCdModelConfigFileName());
|
||||||
|
addReq.setClsModelPath(modelUploadResDto.getClsModelPath());
|
||||||
|
addReq.setClsModelFileName(modelUploadResDto.getClsModelFileName());
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
Long modelUid = modelMngCoreService.insertModel(addReq);
|
Long modelUid = modelMngCoreService.insertModel(addReq);
|
||||||
|
|
||||||
ModelMetricAddReq modelMetricAddReq = new ModelMetricAddReq();
|
ModelMetricAddReq modelMetricAddReq = new ModelMetricAddReq();
|
||||||
@@ -87,7 +104,7 @@ public class ModelMngService {
|
|||||||
modelMetricAddReq.setIou(0);
|
modelMetricAddReq.setIou(0);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String filePath = addReq.getClsModelPath() + addReq.getClsModelFileName();
|
String filePath = modelUploadResDto.getClsModelPath() + modelUploadResDto.getClsModelFileName();
|
||||||
String dataJson = null;
|
String dataJson = null;
|
||||||
try {
|
try {
|
||||||
dataJson = Files.readString(Path.of(filePath));
|
dataJson = Files.readString(Path.of(filePath));
|
||||||
@@ -126,8 +143,9 @@ public class ModelMngService {
|
|||||||
modelUploadResDto.setFileName(upRes.getFileName());
|
modelUploadResDto.setFileName(upRes.getFileName());
|
||||||
modelUploadResDto.setChunkIndex(upRes.getChunkIndex());
|
modelUploadResDto.setChunkIndex(upRes.getChunkIndex());
|
||||||
modelUploadResDto.setChunkTotalIndex(upRes.getChunkTotalIndex());
|
modelUploadResDto.setChunkTotalIndex(upRes.getChunkTotalIndex());
|
||||||
// 압축풀기 (String zipFilePath, String destDirectory)
|
|
||||||
|
|
||||||
|
// 압축풀기 (String zipFilePath, String destDirectory)
|
||||||
|
/*
|
||||||
if (upRes.getChunkIndex() == upRes.getChunkTotalIndex()) {
|
if (upRes.getChunkIndex() == upRes.getChunkTotalIndex()) {
|
||||||
try {
|
try {
|
||||||
FIleChecker.unzip(upRes.getFileName(), upRes.getFilePath());
|
FIleChecker.unzip(upRes.getFileName(), upRes.getFilePath());
|
||||||
@@ -138,6 +156,7 @@ public class ModelMngService {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return modelUploadResDto;
|
return modelUploadResDto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.InferenceBatchShe
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.MapSheet;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.MapSheet;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
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.InferenceServerStatusDto;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetNumDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetNumDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SaveInferenceAiDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SaveInferenceAiDto;
|
||||||
@@ -274,4 +275,8 @@ public class InferenceResultCoreService {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
||||||
|
return mapSheetLearnRepository.getInferenceStatus(uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceProgressDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceProgressDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
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.InferenceServerStatusDto;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -20,4 +21,5 @@ public interface MapSheetLearnRepositoryCustom {
|
|||||||
Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status);
|
Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status);
|
||||||
|
|
||||||
Optional<InferenceProgressDto> getInferenceAiResultById(Long id);
|
Optional<InferenceProgressDto> getInferenceAiResultById(Long id);
|
||||||
|
public InferenceStatusDetailDto getInferenceStatus(UUID uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ import com.kamco.cd.kamcoback.common.utils.DateRange;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceProgressDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceProgressDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
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.InferenceServerStatusDto;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
||||||
|
import com.kamco.cd.kamcoback.model.service.ModelMngService;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
@@ -29,6 +32,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCustom {
|
public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCustom {
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
|
private final ModelMngService modelMngService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<MapSheetLearnEntity> getInferenceMgnResultList(InferenceResultDto.SearchListReq req) {
|
public Page<MapSheetLearnEntity> getInferenceMgnResultList(InferenceResultDto.SearchListReq req) {
|
||||||
@@ -122,7 +126,11 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
gpuMetricEntity.gpuUtil))
|
gpuMetricEntity.gpuUtil))
|
||||||
.from(systemMetricEntity)
|
.from(systemMetricEntity)
|
||||||
.leftJoin(gpuMetricEntity)
|
.leftJoin(gpuMetricEntity)
|
||||||
.on(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))
|
.on(
|
||||||
|
gpuMetricEntity
|
||||||
|
.id1
|
||||||
|
.in(latestGpuIds)
|
||||||
|
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
|
||||||
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
|
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
|
||||||
.orderBy(systemMetricEntity.serverName.asc())
|
.orderBy(systemMetricEntity.serverName.asc())
|
||||||
.limit(4)
|
.limit(4)
|
||||||
@@ -132,13 +140,41 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status) {
|
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
||||||
return Optional.ofNullable(
|
|
||||||
|
String serverNames = "";
|
||||||
|
|
||||||
|
QModelMngEntity m1Model = new QModelMngEntity("m1Model");
|
||||||
|
QModelMngEntity m2Model = new QModelMngEntity("m2Model");
|
||||||
|
QModelMngEntity m3Model = new QModelMngEntity("m3Model");
|
||||||
|
|
||||||
|
InferenceStatusDetailDto foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(mapSheetLearnEntity)
|
.select(
|
||||||
.where(mapSheetLearnEntity.status.eq(status))
|
Projections.constructor(
|
||||||
.limit(1)
|
InferenceStatusDetailDto.class,
|
||||||
.fetchOne());
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user