Merge pull request 'feat/infer_dev_260107' (#205) from feat/infer_dev_260107 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/205
This commit is contained in:
2026-01-12 21:27:58 +09:00
11 changed files with 186 additions and 4 deletions

View File

@@ -256,7 +256,7 @@ public class InferenceResultApiController {
@GetMapping("/status/{uuid}") @GetMapping("/status/{uuid}")
public ApiResponseDto<InferenceStatusDetailDto> getInferenceStatus( public ApiResponseDto<InferenceStatusDetailDto> getInferenceStatus(
@io.swagger.v3.oas.annotations.parameters.RequestBody( @io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "모델 삭제 요청 정보", description = "추론진행현왕 요청 정보",
required = true) required = true)
@PathVariable @PathVariable
UUID uuid) { UUID uuid) {

View File

@@ -398,6 +398,7 @@ public class InferenceDetailDto {
@NoArgsConstructor @NoArgsConstructor
public static class InferenceBatchSheet { public static class InferenceBatchSheet {
private Long id;
private Long m1BatchId; private Long m1BatchId;
private Long m2BatchId; private Long m2BatchId;
private Long m3BatchId; private Long m3BatchId;

View File

@@ -0,0 +1,58 @@
package com.kamco.cd.kamcoback.inference.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class InferenceProgressDto {
private InferenceProgressDto.pred_requests_areas pred_requests_areas;
private String model1_version;
private String model2_version;
private String model3_version;
private String cd_model_path;
private String cd_model_config;
private String cls_model_path;
private String cls_model_version;
private String cd_model_type;
private Integer priority;
public InferenceProgressDto(
InferenceProgressDto.pred_requests_areas pred_requests_areas,
String model1_version,
String model2_version,
String model3_version,
String cd_model_path,
String cd_model_config,
String cls_model_path,
String cls_model_version,
String cd_model_type,
Integer priority) {
this.pred_requests_areas = pred_requests_areas;
this.model1_version = model1_version;
this.model2_version = model2_version;
this.model3_version = model3_version;
this.cd_model_path = cd_model_path;
this.cd_model_config = cd_model_config;
this.cls_model_path = cls_model_path;
this.cls_model_version = cls_model_version;
this.cd_model_type = cd_model_type;
this.priority = priority;
}
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public static class pred_requests_areas {
private Integer input1_year;
private Integer input2_year;
private String input1_scene_path;
private String input2_scene_path;
}
}

View File

@@ -372,5 +372,7 @@ public class InferenceResultDto {
private String status; private String status;
private String type; private String type;
private ZonedDateTime inferStartDttm; private ZonedDateTime inferStartDttm;
private String modelComparePath;
private String modelTargetPath;
} }
} }

View File

@@ -7,8 +7,8 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
@AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor
public class InferenceSendDto { public class InferenceSendDto {
private pred_requests_areas pred_requests_areas; private pred_requests_areas pred_requests_areas;

View File

@@ -210,6 +210,8 @@ public class InferenceResultService {
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId()); saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
saveInferenceAiDto.setType("M1"); saveInferenceAiDto.setType("M1");
saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now()); saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now());
saveInferenceAiDto.setModelComparePath(modelComparePath);
saveInferenceAiDto.setModelTargetPath(modelTargetPath);
inferenceResultCoreService.update(saveInferenceAiDto); inferenceResultCoreService.update(saveInferenceAiDto);
} }

View File

@@ -235,10 +235,20 @@ public class InferenceResultCoreService {
entity.setM3ModelBatchId(request.getBatchId()); entity.setM3ModelBatchId(request.getBatchId());
} }
entity.setStatus(request.getStatus());
if (request.getInferStartDttm() != null) { if (request.getInferStartDttm() != null) {
entity.setInferStartDttm(request.getInferStartDttm()); entity.setInferStartDttm(request.getInferStartDttm());
} }
if (request.getModelComparePath() != null) {
entity.setModelComparePath(request.getModelComparePath());
}
if (request.getModelTargetPath() != null) {
entity.setModelTargetPath(request.getModelTargetPath());
}
entity.setRunningModelType(request.getType());
entity.setStatus(request.getStatus());
} }
public List<InferenceServerStatusDto> getInferenceServerStatusList() { public List<InferenceServerStatusDto> getInferenceServerStatusList() {
@@ -252,6 +262,7 @@ public class InferenceResultCoreService {
.orElseThrow(() -> new EntityNotFoundException(status)); .orElseThrow(() -> new EntityNotFoundException(status));
InferenceBatchSheet inferenceBatchSheet = new InferenceBatchSheet(); InferenceBatchSheet inferenceBatchSheet = new InferenceBatchSheet();
inferenceBatchSheet.setId(entity.getId());
inferenceBatchSheet.setM1BatchId(entity.getM1ModelBatchId()); inferenceBatchSheet.setM1BatchId(entity.getM1ModelBatchId());
inferenceBatchSheet.setM2BatchId(entity.getM2ModelBatchId()); inferenceBatchSheet.setM2BatchId(entity.getM2ModelBatchId());
inferenceBatchSheet.setM3BatchId(entity.getM3ModelBatchId()); inferenceBatchSheet.setM3BatchId(entity.getM3ModelBatchId());
@@ -260,6 +271,11 @@ public class InferenceResultCoreService {
return inferenceBatchSheet; return inferenceBatchSheet;
} }
public SaveInferenceAiDto getInferenceAiResultById(Long id) {
return null;
}
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) { public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
return mapSheetLearnRepository.getInferenceStatus(uuid); return mapSheetLearnRepository.getInferenceStatus(uuid);
} }

View File

@@ -118,6 +118,12 @@ public class MapSheetLearnEntity {
@Column(name = "detect_end_cnt") @Column(name = "detect_end_cnt")
private Long detectEndCnt; private Long detectEndCnt;
@Column(name = "model_compare_path")
private String modelComparePath;
@Column(name = "model_target_path")
private String modelTargetPath;
public InferenceResultDto.ResultList toDto() { public InferenceResultDto.ResultList toDto() {
return new InferenceResultDto.ResultList( return new InferenceResultDto.ResultList(
this.uuid, this.uuid,

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.postgres.repository.Inference; package com.kamco.cd.kamcoback.postgres.repository.Inference;
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.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
@@ -17,5 +18,9 @@ public interface MapSheetLearnRepositoryCustom {
List<InferenceServerStatusDto> getInferenceServerStatusList(); List<InferenceServerStatusDto> getInferenceServerStatusList();
Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status);
Optional<InferenceProgressDto> getInferenceAiResultById(Long id);
public InferenceStatusDetailDto getInferenceStatus(UUID uuid); public InferenceStatusDetailDto getInferenceStatus(UUID uuid);
} }

View File

@@ -5,6 +5,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapShe
import static com.kamco.cd.kamcoback.postgres.entity.QSystemMetricEntity.systemMetricEntity; import static com.kamco.cd.kamcoback.postgres.entity.QSystemMetricEntity.systemMetricEntity;
import com.kamco.cd.kamcoback.common.utils.DateRange; import com.kamco.cd.kamcoback.common.utils.DateRange;
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.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
@@ -138,6 +139,16 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
return foundContent; return foundContent;
} }
@Override
public Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status) {
return Optional.ofNullable(
queryFactory
.selectFrom(mapSheetLearnEntity)
.where(mapSheetLearnEntity.status.eq(status))
.limit(1)
.fetchOne());
}
@Override @Override
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) { public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
@@ -175,4 +186,34 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
return foundContent; return foundContent;
} }
@Override
public Optional<InferenceProgressDto> getInferenceAiResultById(Long id) {
// InferenceProgressDto dto =
// queryFactory
// .select(
// Projections.constructor(
// InferenceProgressDto.class,
// Projections.constructor(
// InferenceProgressDto.pred_requests_areas.class,
// mapSheetLearnEntity.compareYyyy,
// mapSheetLearnEntity.targetYyyy,
// mapSheetLearnEntity.modelComparePath,
// mapSheetLearnEntity.modelTargetPath
// ),
// modelMngEntity.uuid.eq(mapSheetLearnEntity.m1ModelUuid).as("m1ModelUuid"),
// modelMngEntity.uuid.eq(mapSheetLearnEntity.m2ModelUuid).as("m2ModelUuid"),
// mapSheetLearnEntity.cdModelPath,
// mapSheetLearnEntity.cdModelConfig,
// mapSheetLearnEntity.clsModelPath,
// mapSheetLearnEntity.clsModelVersion,
// mapSheetLearnEntity.cdModelType,
// mapSheetLearnEntity.priority
// )
// )
// .from(mapSheetLearnEntity)
// .where(mapSheetLearnEntity.id.eq(id))
// .fetchOne();
return Optional.empty();
}
} }

View File

@@ -59,6 +59,10 @@ public class MapSheetInferenceJobService {
batchId = batchSheet.getM1BatchId(); batchId = batchSheet.getM1BatchId();
} }
if (batchId == 0L) {
return;
}
String url = batchUrl + "/" + batchId; String url = batchUrl + "/" + batchId;
ExternalCallResult<String> result = ExternalCallResult<String> result =
@@ -75,7 +79,13 @@ public class MapSheetInferenceJobService {
if ("COMPLETED".equals(dto.getStatus())) { if ("COMPLETED".equals(dto.getStatus())) {
String type = batchSheet.getRunningModelType(); String type = batchSheet.getRunningModelType();
// if(type.equals("M3")) if (type.equals("M1")) {
} else if (type.equals("M2")) {
} else if (type.equals("M3")) {
}
} }
System.out.println(dto); System.out.println(dto);
@@ -89,4 +99,45 @@ public class MapSheetInferenceJobService {
log.info("1분 배치 종료"); log.info("1분 배치 종료");
} }
private void startInference(Long id, String type) {
// InferenceResultDto.SaveInferenceAiDto req
// inferenceResultCoreService.getInferenceResultByU
//
// List<MapSheetNumDto> mapSheetNum = req.getMapSheetNum();
// List<String> mapSheetNumList = new ArrayList<>();
//
// for (MapSheetNumDto mapSheetDto : mapSheetNum) {
// mapSheetNumList.add(mapSheetDto.getMapSheetNum());
// }
//
// String modelComparePath =
// this.getSceneInference(String.valueOf(req.getCompareYyyy()), mapSheetNumList);
// String modelTargetPath =
// this.getSceneInference(String.valueOf(req.getTargetYyyy()), mapSheetNumList);
//
// pred_requests_areas predRequestsAreas = new pred_requests_areas();
// predRequestsAreas.setInput1_year(req.getCompareYyyy());
// predRequestsAreas.setInput2_year(req.getTargetYyyy());
// predRequestsAreas.setInput1_scene_path(modelComparePath);
// predRequestsAreas.setInput2_scene_path(modelTargetPath);
//
// InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
// InferenceSendDto m2 = this.getModelInfo(req.getModel2Uuid());
// InferenceSendDto m3 = this.getModelInfo(req.getModel3Uuid());
//
// m1.setPred_requests_areas(predRequestsAreas);
// m2.setPred_requests_areas(predRequestsAreas);
// m3.setPred_requests_areas(predRequestsAreas);
//
// Long batchId = this.ensureAccepted(m1);
//
// SaveInferenceAiDto saveInferenceAiDto = new SaveInferenceAiDto();
// saveInferenceAiDto.setUuid(uuid);
// saveInferenceAiDto.setBatchId(batchId);
// saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
// saveInferenceAiDto.setType("M1");
// saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now());
// inferenceResultCoreService.update(saveInferenceAiDto);
}
} }