[KC-108] ai api batch 작업중
This commit is contained in:
@@ -398,6 +398,7 @@ public class InferenceDetailDto {
|
||||
@NoArgsConstructor
|
||||
public static class InferenceBatchSheet {
|
||||
|
||||
private Long id;
|
||||
private Long m1BatchId;
|
||||
private Long m2BatchId;
|
||||
private Long m3BatchId;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -309,5 +309,7 @@ public class InferenceResultDto {
|
||||
private String status;
|
||||
private String type;
|
||||
private ZonedDateTime inferStartDttm;
|
||||
private String modelComparePath;
|
||||
private String modelTargetPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InferenceSendDto {
|
||||
|
||||
private pred_requests_areas pred_requests_areas;
|
||||
|
||||
@@ -209,6 +209,8 @@ public class InferenceResultService {
|
||||
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
|
||||
saveInferenceAiDto.setType("M1");
|
||||
saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now());
|
||||
saveInferenceAiDto.setModelComparePath(modelComparePath);
|
||||
saveInferenceAiDto.setModelTargetPath(modelTargetPath);
|
||||
inferenceResultCoreService.update(saveInferenceAiDto);
|
||||
}
|
||||
|
||||
|
||||
@@ -234,10 +234,20 @@ public class InferenceResultCoreService {
|
||||
entity.setM3ModelBatchId(request.getBatchId());
|
||||
}
|
||||
|
||||
entity.setStatus(request.getStatus());
|
||||
if (request.getInferStartDttm() != null) {
|
||||
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() {
|
||||
@@ -251,6 +261,7 @@ public class InferenceResultCoreService {
|
||||
.orElseThrow(() -> new EntityNotFoundException(status));
|
||||
|
||||
InferenceBatchSheet inferenceBatchSheet = new InferenceBatchSheet();
|
||||
inferenceBatchSheet.setId(entity.getId());
|
||||
inferenceBatchSheet.setM1BatchId(entity.getM1ModelBatchId());
|
||||
inferenceBatchSheet.setM2BatchId(entity.getM2ModelBatchId());
|
||||
inferenceBatchSheet.setM3BatchId(entity.getM3ModelBatchId());
|
||||
@@ -258,4 +269,9 @@ public class InferenceResultCoreService {
|
||||
inferenceBatchSheet.setRunningModelType(entity.getRunningModelType());
|
||||
return inferenceBatchSheet;
|
||||
}
|
||||
|
||||
public SaveInferenceAiDto getInferenceAiResultById(Long id) {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +118,12 @@ public class MapSheetLearnEntity {
|
||||
@Column(name = "detect_end_cnt")
|
||||
private Long detectEndCnt;
|
||||
|
||||
@Column(name = "model_compare_path")
|
||||
private String modelComparePath;
|
||||
|
||||
@Column(name = "model_target_path")
|
||||
private String modelTargetPath;
|
||||
|
||||
public InferenceResultDto.ResultList toDto() {
|
||||
return new InferenceResultDto.ResultList(
|
||||
this.uuid,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.InferenceServerStatusDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||
@@ -17,4 +18,6 @@ public interface MapSheetLearnRepositoryCustom {
|
||||
List<InferenceServerStatusDto> getInferenceServerStatusList();
|
||||
|
||||
Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status);
|
||||
|
||||
Optional<InferenceProgressDto> getInferenceAiResultById(Long id);
|
||||
}
|
||||
|
||||
@@ -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 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.InferenceServerStatusDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||
@@ -139,4 +140,34 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
.limit(1)
|
||||
.fetchOne());
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,13 @@ public class MapSheetInferenceJobService {
|
||||
if ("COMPLETED".equals(dto.getStatus())) {
|
||||
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);
|
||||
@@ -89,4 +95,45 @@ public class MapSheetInferenceJobService {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user