하이퍼파라미터 , 모델관리 수정
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
package com.kamco.cd.training.common.enums;
|
||||||
|
|
||||||
|
import com.kamco.cd.training.common.utils.enums.CodeExpose;
|
||||||
|
import com.kamco.cd.training.common.utils.enums.EnumType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@CodeExpose
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum TrainType implements EnumType {
|
||||||
|
GENERAL("일반"),
|
||||||
|
TRANSFER("전이");
|
||||||
|
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -138,7 +138,7 @@ public class HyperParamApiController {
|
|||||||
})
|
})
|
||||||
@DeleteMapping("/{uuid}")
|
@DeleteMapping("/{uuid}")
|
||||||
public ApiResponseDto<Void> deleteHyperParam(
|
public ApiResponseDto<Void> deleteHyperParam(
|
||||||
@Parameter(description = "하이퍼파라미터 uuid", example = "7966dd64-004a-4596-89ef-001664bc4de2")
|
@Parameter(description = "하이퍼파라미터 uuid", example = "c3b5a285-8f68-42af-84f0-e6d09162deb5")
|
||||||
@PathVariable
|
@PathVariable
|
||||||
UUID uuid) {
|
UUID uuid) {
|
||||||
hyperParamService.deleteHyperParam(uuid);
|
hyperParamService.deleteHyperParam(uuid);
|
||||||
@@ -160,7 +160,7 @@ public class HyperParamApiController {
|
|||||||
})
|
})
|
||||||
@GetMapping("/{uuid}")
|
@GetMapping("/{uuid}")
|
||||||
public ApiResponseDto<HyperParamDto.Basic> getHyperParam(
|
public ApiResponseDto<HyperParamDto.Basic> getHyperParam(
|
||||||
@Parameter(description = "하이퍼파라미터 uuid", example = "9c91a20c-71e7-4e5f-a860-9626d2b2059c")
|
@Parameter(description = "하이퍼파라미터 uuid", example = "c3b5a285-8f68-42af-84f0-e6d09162deb5")
|
||||||
@PathVariable
|
@PathVariable
|
||||||
UUID uuid) {
|
UUID uuid) {
|
||||||
return ApiResponseDto.ok(hyperParamService.getHyperParam(uuid));
|
return ApiResponseDto.ok(hyperParamService.getHyperParam(uuid));
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.kamco.cd.training.model.dto;
|
package com.kamco.cd.training.model.dto;
|
||||||
|
|
||||||
|
import com.kamco.cd.training.common.enums.TrainStatusType;
|
||||||
|
import com.kamco.cd.training.common.enums.TrainType;
|
||||||
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
|
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -31,14 +34,72 @@ public class ModelMngDto {
|
|||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
private String modelVer;
|
private String modelVer;
|
||||||
@JsonFormatDttm private ZonedDateTime startDttm;
|
@JsonFormatDttm private ZonedDateTime startDttm;
|
||||||
|
@JsonFormatDttm private ZonedDateTime step1StrtDttm;
|
||||||
@JsonFormatDttm private ZonedDateTime step1EndDttm;
|
@JsonFormatDttm private ZonedDateTime step1EndDttm;
|
||||||
@JsonFormatDttm private ZonedDateTime step1Duration;
|
@JsonFormatDttm private ZonedDateTime step2StrtDttm;
|
||||||
@JsonFormatDttm private ZonedDateTime step2EndDttm;
|
@JsonFormatDttm private ZonedDateTime step2EndDttm;
|
||||||
@JsonFormatDttm private ZonedDateTime step2Duration;
|
|
||||||
private String step1Status;
|
private String step1Status;
|
||||||
private String step2Status;
|
private String step2Status;
|
||||||
private String transferStatus;
|
|
||||||
private String statusCd;
|
private String statusCd;
|
||||||
|
private String trainType;
|
||||||
|
|
||||||
|
public String getStatusName() {
|
||||||
|
if (this.statusCd == null || this.statusCd.isBlank()) return null;
|
||||||
|
try {
|
||||||
|
return TrainStatusType.valueOf(this.statusCd).getText(); // 또는 getName()
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return this.statusCd; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStep1StatusName() {
|
||||||
|
if (this.step1Status == null || this.step1Status.isBlank()) return null;
|
||||||
|
try {
|
||||||
|
return TrainStatusType.valueOf(this.step1Status).getText(); // 또는 getName()
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return this.step1Status; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStep2StatusNAme() {
|
||||||
|
if (this.step2Status == null || this.step2Status.isBlank()) return null;
|
||||||
|
try {
|
||||||
|
return TrainStatusType.valueOf(this.step2Status).getText(); // 또는 getName()
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return this.step2Status; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTrainTypeName() {
|
||||||
|
if (this.trainType == null || this.trainType.isBlank()) return null;
|
||||||
|
try {
|
||||||
|
return TrainType.valueOf(this.trainType).getText(); // 또는 getName()
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return this.trainType; // 매핑 못하면 코드 그대로 반환(원하면 null 처리)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatDuration(ZonedDateTime start, ZonedDateTime end) {
|
||||||
|
if (start == null || end == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
long totalSeconds = Math.abs(Duration.between(start, end).getSeconds());
|
||||||
|
|
||||||
|
long hours = totalSeconds / 3600;
|
||||||
|
long minutes = (totalSeconds % 3600) / 60;
|
||||||
|
long seconds = totalSeconds % 60;
|
||||||
|
|
||||||
|
return String.format("%d시간 %d분 %d초", hours, minutes, seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStep1Duration() {
|
||||||
|
return formatDuration(this.step1StrtDttm, this.step1EndDttm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStep2Duration() {
|
||||||
|
return formatDuration(this.step2StrtDttm, this.step2EndDttm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(name = "searchReq", description = "모델 관리 목록조회 파라미터")
|
@Schema(name = "searchReq", description = "모델 관리 목록조회 파라미터")
|
||||||
|
|||||||
@@ -29,7 +29,14 @@ public class ModelMngService {
|
|||||||
return modelMngCoreService.findByModelList(searchReq);
|
return modelMngCoreService.findByModelList(searchReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteModelTrain(UUID uuid) {}
|
/**
|
||||||
|
* 학습모델 삭제
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
*/
|
||||||
|
public void deleteModelTrain(UUID uuid) {
|
||||||
|
modelMngCoreService.deleteModel(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 모델 상세 조회
|
* 모델 상세 조회
|
||||||
@@ -40,14 +47,4 @@ public class ModelMngService {
|
|||||||
public ModelMngDto.Detail getModelDetail(Long modelUid) {
|
public ModelMngDto.Detail getModelDetail(Long modelUid) {
|
||||||
return modelMngCoreService.getModelDetail(modelUid);
|
return modelMngCoreService.getModelDetail(modelUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 모델 상세 조회 (UUID 기반)
|
|
||||||
*
|
|
||||||
* @param uuid 모델 UUID
|
|
||||||
* @return 모델 상세 정보
|
|
||||||
*/
|
|
||||||
public ModelMngDto.Detail getModelDetailByUuid(String uuid) {
|
|
||||||
return modelMngCoreService.getModelDetailByUuid(uuid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ import com.kamco.cd.training.common.exception.BadRequestException;
|
|||||||
import com.kamco.cd.training.common.exception.NotFoundException;
|
import com.kamco.cd.training.common.exception.NotFoundException;
|
||||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.training.postgres.core.DatasetCoreService;
|
import com.kamco.cd.training.postgres.core.DatasetCoreService;
|
||||||
import com.kamco.cd.training.postgres.core.HyperParamCoreService;
|
|
||||||
import com.kamco.cd.training.postgres.core.ModelMngCoreService;
|
import com.kamco.cd.training.postgres.core.ModelMngCoreService;
|
||||||
import com.kamco.cd.training.postgres.core.SystemMetricsCoreService;
|
import com.kamco.cd.training.postgres.core.SystemMetricsCoreService;
|
||||||
import com.kamco.cd.training.postgres.entity.ModelTrainMasterEntity;
|
import com.kamco.cd.training.postgres.entity.ModelMasterEntity;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -21,19 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
public class ModelTrainService {
|
public class ModelTrainService {
|
||||||
|
|
||||||
private final ModelMngCoreService modelMngCoreService;
|
private final ModelMngCoreService modelMngCoreService;
|
||||||
private final HyperParamCoreService hyperParamCoreService;
|
|
||||||
private final DatasetCoreService datasetCoreService;
|
private final DatasetCoreService datasetCoreService;
|
||||||
private final SystemMetricsCoreService systemMetricsCoreService;
|
private final SystemMetricsCoreService systemMetricsCoreService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 학습 모델 목록 조회
|
|
||||||
*
|
|
||||||
* @return 학습 모델 목록
|
|
||||||
*/
|
|
||||||
public List<ModelMngDto.TrainListRes> getTrainModelList() {
|
|
||||||
return modelMngCoreService.findAllTrainModels();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 학습 설정 통합 조회
|
* 학습 설정 통합 조회
|
||||||
*
|
*
|
||||||
@@ -99,7 +88,7 @@ public class ModelTrainService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 5. 학습 마스터 생성
|
// 5. 학습 마스터 생성
|
||||||
ModelTrainMasterEntity entity = modelMngCoreService.createTrainMaster(trainReq);
|
ModelMasterEntity entity = modelMngCoreService.createTrainMaster(trainReq);
|
||||||
|
|
||||||
// 5. 데이터셋 매핑 생성
|
// 5. 데이터셋 매핑 생성
|
||||||
modelMngCoreService.createDatasetMappings(entity.getId(), trainReq.getDatasetIds());
|
modelMngCoreService.createDatasetMappings(entity.getId(), trainReq.getDatasetIds());
|
||||||
@@ -178,39 +167,28 @@ public class ModelTrainService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 학습 모델 삭제
|
|
||||||
*
|
|
||||||
* @param uuid 모델 UUID
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public void deleteTrainModel(String uuid) {
|
|
||||||
modelMngCoreService.deleteByUuid(uuid);
|
|
||||||
log.info("학습 모델 삭제 완료: uuid={}", uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================== Resume Training (학습 재시작) ====================
|
// ==================== Resume Training (학습 재시작) ====================
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 학습 재시작 정보 조회
|
// * 학습 재시작 정보 조회
|
||||||
*
|
// *
|
||||||
* @param uuid 모델 UUID
|
// * @param uuid 모델 UUID
|
||||||
* @return 재시작 정보
|
// * @return 재시작 정보
|
||||||
*/
|
// */
|
||||||
public ModelMngDto.ResumeInfo getResumeInfo(String uuid) {
|
// public ModelMngDto.ResumeInfo getResumeInfo(String uuid) {
|
||||||
ModelTrainMasterEntity entity = modelMngCoreService.findByUuid(uuid);
|
// ModelTrainMasterEntity entity = modelMngCoreService.findByUuid(uuid);
|
||||||
|
//
|
||||||
return ModelMngDto.ResumeInfo.builder()
|
// return ModelMngDto.ResumeInfo.builder()
|
||||||
.canResume(entity.getCanResume() != null && entity.getCanResume())
|
// .canResume(entity.getCanResume() != null && entity.getCanResume())
|
||||||
.lastEpoch(entity.getLastCheckpointEpoch())
|
// .lastEpoch(entity.getLastCheckpointEpoch())
|
||||||
.totalEpoch(entity.getEpochCnt())
|
// .totalEpoch(entity.getEpochCnt())
|
||||||
.checkpointPath(entity.getCheckpointPath())
|
// .checkpointPath(entity.getCheckpointPath())
|
||||||
// .failedAt(
|
// // .failedAt(
|
||||||
// entity.getStopDttm() != null
|
// // entity.getStopDttm() != null
|
||||||
// ? entity.getStopDttm().atZone(java.time.ZoneId.systemDefault())
|
// // ? entity.getStopDttm().atZone(java.time.ZoneId.systemDefault())
|
||||||
// : null)
|
// // : null)
|
||||||
.build();
|
// .build();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 학습 재시작
|
* 학습 재시작
|
||||||
@@ -222,41 +200,42 @@ public class ModelTrainService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public ModelMngDto.ResumeResponse resumeTraining(
|
public ModelMngDto.ResumeResponse resumeTraining(
|
||||||
String uuid, ModelMngDto.ResumeRequest resumeReq) {
|
String uuid, ModelMngDto.ResumeRequest resumeReq) {
|
||||||
ModelTrainMasterEntity entity = modelMngCoreService.findByUuid(uuid);
|
// ModelTrainMasterEntity entity = modelMngCoreService.findByUuid(uuid);
|
||||||
|
//
|
||||||
|
// // 재시작 가능 여부 검증
|
||||||
|
// if (entity.getCanResume() == null || !entity.getCanResume()) {
|
||||||
|
// throw new IllegalStateException("학습 재시작이 불가능한 모델입니다: " + uuid);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (entity.getLastCheckpointEpoch() == null) {
|
||||||
|
// throw new IllegalStateException("Checkpoint가 존재하지 않습니다: " + uuid);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 상태 업데이트
|
||||||
|
// entity.setStatusCd("RUNNING");
|
||||||
|
// entity.setProgressRate(0);
|
||||||
|
//
|
||||||
|
// // 총 Epoch 수 변경 (선택사항)
|
||||||
|
// if (resumeReq.getNewTotalEpoch() != null) {
|
||||||
|
// entity.setEpochCnt(resumeReq.getNewTotalEpoch());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// log.info(
|
||||||
|
// "학습 재시작: uuid={}, resumeFromEpoch={}, totalEpoch={}",
|
||||||
|
// uuid,
|
||||||
|
// resumeReq.getResumeFromEpoch(),
|
||||||
|
// entity.getEpochCnt());
|
||||||
|
//
|
||||||
|
// // TODO: 비동기 GPU 학습 재시작 프로세스 트리거 로직 추가
|
||||||
|
// // - Checkpoint 파일 로드
|
||||||
|
// // - 지정된 Epoch부터 학습 재개
|
||||||
|
|
||||||
// 재시작 가능 여부 검증
|
return null;
|
||||||
if (entity.getCanResume() == null || !entity.getCanResume()) {
|
// ModelMngDto.ResumeResponse.builder()
|
||||||
throw new IllegalStateException("학습 재시작이 불가능한 모델입니다: " + uuid);
|
// .uuid(uuid)
|
||||||
}
|
// .status(entity.getStatusCd())
|
||||||
|
// .resumedFromEpoch(resumeReq.getResumeFromEpoch())
|
||||||
if (entity.getLastCheckpointEpoch() == null) {
|
// .build();
|
||||||
throw new IllegalStateException("Checkpoint가 존재하지 않습니다: " + uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 상태 업데이트
|
|
||||||
entity.setStatusCd("RUNNING");
|
|
||||||
entity.setProgressRate(0);
|
|
||||||
|
|
||||||
// 총 Epoch 수 변경 (선택사항)
|
|
||||||
if (resumeReq.getNewTotalEpoch() != null) {
|
|
||||||
entity.setEpochCnt(resumeReq.getNewTotalEpoch());
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info(
|
|
||||||
"학습 재시작: uuid={}, resumeFromEpoch={}, totalEpoch={}",
|
|
||||||
uuid,
|
|
||||||
resumeReq.getResumeFromEpoch(),
|
|
||||||
entity.getEpochCnt());
|
|
||||||
|
|
||||||
// TODO: 비동기 GPU 학습 재시작 프로세스 트리거 로직 추가
|
|
||||||
// - Checkpoint 파일 로드
|
|
||||||
// - 지정된 Epoch부터 학습 재개
|
|
||||||
|
|
||||||
return ModelMngDto.ResumeResponse.builder()
|
|
||||||
.uuid(uuid)
|
|
||||||
.status(entity.getStatusCd())
|
|
||||||
.resumedFromEpoch(resumeReq.getResumeFromEpoch())
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== Best Epoch Setting (Best Epoch 설정) ====================
|
// ==================== Best Epoch Setting (Best Epoch 설정) ====================
|
||||||
@@ -271,47 +250,49 @@ public class ModelTrainService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public ModelMngDto.BestEpochResponse setBestEpoch(
|
public ModelMngDto.BestEpochResponse setBestEpoch(
|
||||||
String uuid, ModelMngDto.BestEpochRequest bestEpochReq) {
|
String uuid, ModelMngDto.BestEpochRequest bestEpochReq) {
|
||||||
ModelTrainMasterEntity entity = modelMngCoreService.findByUuid(uuid);
|
// ModelTrainMasterEntity entity = modelMngCoreService.findByUuid(uuid);
|
||||||
|
//
|
||||||
// 1차 학습 완료 상태 검증
|
// // 1차 학습 완료 상태 검증
|
||||||
if (!"STEP1_COMPLETED".equals(entity.getStatusCd())
|
// if (!"STEP1_COMPLETED".equals(entity.getStatusCd())
|
||||||
&& !"STEP1".equals(entity.getProcessStep())) {
|
// && !"STEP1".equals(entity.getProcessStep())) {
|
||||||
log.warn(
|
// log.warn(
|
||||||
"Best Epoch 설정 시도: 현재 상태={}, processStep={}",
|
// "Best Epoch 설정 시도: 현재 상태={}, processStep={}",
|
||||||
entity.getStatusCd(),
|
// entity.getStatusCd(),
|
||||||
entity.getProcessStep());
|
// entity.getProcessStep());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Integer previousBestEpoch = entity.getConfirmedBestEpoch();
|
// Integer previousBestEpoch = entity.getConfirmedBestEpoch();
|
||||||
|
//
|
||||||
// 사용자가 확정한 Best Epoch 설정
|
// // 사용자가 확정한 Best Epoch 설정
|
||||||
entity.setConfirmedBestEpoch(bestEpochReq.getBestEpoch());
|
// entity.setConfirmedBestEpoch(bestEpochReq.getBestEpoch());
|
||||||
|
//
|
||||||
// 2차 학습(Test) 단계로 상태 전이
|
// // 2차 학습(Test) 단계로 상태 전이
|
||||||
entity.setProcessStep("STEP2");
|
// entity.setProcessStep("STEP2");
|
||||||
entity.setStatusCd("STEP2_RUNNING");
|
// entity.setStatusCd("STEP2_RUNNING");
|
||||||
entity.setProgressRate(0);
|
// entity.setProgressRate(0);
|
||||||
entity.setUpdatedDttm(java.time.ZonedDateTime.now());
|
// entity.setUpdatedDttm(java.time.ZonedDateTime.now());
|
||||||
|
//
|
||||||
log.info(
|
// log.info(
|
||||||
"Best Epoch 설정 및 2차 학습 시작: uuid={}, newBestEpoch={}, previousBestEpoch={}, reason={}, newStatus={}",
|
// "Best Epoch 설정 및 2차 학습 시작: uuid={}, newBestEpoch={}, previousBestEpoch={}, reason={},
|
||||||
uuid,
|
// newStatus={}",
|
||||||
bestEpochReq.getBestEpoch(),
|
// uuid,
|
||||||
previousBestEpoch,
|
// bestEpochReq.getBestEpoch(),
|
||||||
bestEpochReq.getReason(),
|
// previousBestEpoch,
|
||||||
entity.getStatusCd());
|
// bestEpochReq.getReason(),
|
||||||
|
// entity.getStatusCd());
|
||||||
|
|
||||||
// TODO: 비동기 GPU 2차 학습(Test) 프로세스 트리거 로직 추가
|
// TODO: 비동기 GPU 2차 학습(Test) 프로세스 트리거 로직 추가
|
||||||
// - Best Epoch 모델 로드
|
// - Best Epoch 모델 로드
|
||||||
// - Test 데이터셋으로 성능 평가 실행
|
// - Test 데이터셋으로 성능 평가 실행
|
||||||
// - 완료 시 STEP2_COMPLETED 상태로 전환
|
// - 완료 시 STEP2_COMPLETED 상태로 전환
|
||||||
|
|
||||||
return ModelMngDto.BestEpochResponse.builder()
|
return null;
|
||||||
.uuid(uuid)
|
// ModelMngDto.BestEpochResponse.builder()
|
||||||
.bestEpoch(entity.getBestEpoch()) // 자동 선택된 값
|
// .uuid(uuid)
|
||||||
.confirmedBestEpoch(entity.getConfirmedBestEpoch()) // 사용자 확정 값
|
// .bestEpoch(entity.getBestEpoch()) // 자동 선택된 값
|
||||||
.previousBestEpoch(previousBestEpoch)
|
// .confirmedBestEpoch(entity.getConfirmedBestEpoch()) // 사용자 확정 값
|
||||||
.build();
|
// .previousBestEpoch(previousBestEpoch)
|
||||||
|
// .build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -321,33 +302,33 @@ public class ModelTrainService {
|
|||||||
* @return Epoch별 성능 지표 목록
|
* @return Epoch별 성능 지표 목록
|
||||||
*/
|
*/
|
||||||
public List<ModelMngDto.EpochMetric> getEpochMetrics(String uuid) {
|
public List<ModelMngDto.EpochMetric> getEpochMetrics(String uuid) {
|
||||||
ModelTrainMasterEntity entity = modelMngCoreService.findByUuid(uuid);
|
// ModelTrainMasterEntity entity = modelMngCoreService.findByUuid(uuid);
|
||||||
|
//
|
||||||
|
// // TODO: 실제 학습 로그 파일이나 DB에서 Epoch별 성능 지표 조회
|
||||||
|
// // 현재는 샘플 데이터 반환
|
||||||
|
// List<ModelMngDto.EpochMetric> metrics = new java.util.ArrayList<>();
|
||||||
|
//
|
||||||
|
// if (entity.getEpochCnt() != null && entity.getBestEpoch() != null) {
|
||||||
|
// // 샘플 데이터 생성 (실제로는 학습 로그 파일 파싱 또는 별도 테이블 조회)
|
||||||
|
// for (int i = 1; i <= Math.min(entity.getEpochCnt(), 10); i++) {
|
||||||
|
// int epoch = entity.getBestEpoch() - 5 + i;
|
||||||
|
// if (epoch <= 0 || epoch > entity.getEpochCnt()) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// metrics.add(
|
||||||
|
// ModelMngDto.EpochMetric.builder()
|
||||||
|
// .epoch(epoch)
|
||||||
|
// .mIoU(0.80 + (Math.random() * 0.15)) // 샘플 데이터
|
||||||
|
// .mFscore(0.85 + (Math.random() * 0.10)) // 샘플 데이터
|
||||||
|
// .loss(0.3 - (Math.random() * 0.15)) // 샘플 데이터
|
||||||
|
// .isBest(entity.getBestEpoch() != null && epoch == entity.getBestEpoch())
|
||||||
|
// .build());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// log.info("Epoch별 성능 지표 조회: uuid={}, metricsCount={}", uuid, metrics.size());
|
||||||
|
|
||||||
// TODO: 실제 학습 로그 파일이나 DB에서 Epoch별 성능 지표 조회
|
return null; // metrics;
|
||||||
// 현재는 샘플 데이터 반환
|
|
||||||
List<ModelMngDto.EpochMetric> metrics = new java.util.ArrayList<>();
|
|
||||||
|
|
||||||
if (entity.getEpochCnt() != null && entity.getBestEpoch() != null) {
|
|
||||||
// 샘플 데이터 생성 (실제로는 학습 로그 파일 파싱 또는 별도 테이블 조회)
|
|
||||||
for (int i = 1; i <= Math.min(entity.getEpochCnt(), 10); i++) {
|
|
||||||
int epoch = entity.getBestEpoch() - 5 + i;
|
|
||||||
if (epoch <= 0 || epoch > entity.getEpochCnt()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
metrics.add(
|
|
||||||
ModelMngDto.EpochMetric.builder()
|
|
||||||
.epoch(epoch)
|
|
||||||
.mIoU(0.80 + (Math.random() * 0.15)) // 샘플 데이터
|
|
||||||
.mFscore(0.85 + (Math.random() * 0.10)) // 샘플 데이터
|
|
||||||
.loss(0.3 - (Math.random() * 0.15)) // 샘플 데이터
|
|
||||||
.isBest(entity.getBestEpoch() != null && epoch == entity.getBestEpoch())
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("Epoch별 성능 지표 조회: uuid={}, metricsCount={}", uuid, metrics.size());
|
|
||||||
|
|
||||||
return metrics;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package com.kamco.cd.training.postgres.core;
|
|||||||
import com.kamco.cd.training.common.exception.BadRequestException;
|
import com.kamco.cd.training.common.exception.BadRequestException;
|
||||||
import com.kamco.cd.training.common.exception.CustomApiException;
|
import com.kamco.cd.training.common.exception.CustomApiException;
|
||||||
import com.kamco.cd.training.common.exception.NotFoundException;
|
import com.kamco.cd.training.common.exception.NotFoundException;
|
||||||
|
import com.kamco.cd.training.common.utils.UserUtil;
|
||||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.training.model.dto.ModelMngDto.Basic;
|
import com.kamco.cd.training.model.dto.ModelMngDto.Basic;
|
||||||
import com.kamco.cd.training.postgres.entity.ModelDatasetMappEntity;
|
import com.kamco.cd.training.postgres.entity.ModelDatasetMappEntity;
|
||||||
import com.kamco.cd.training.postgres.entity.ModelTrainMasterEntity;
|
import com.kamco.cd.training.postgres.entity.ModelMasterEntity;
|
||||||
import com.kamco.cd.training.postgres.repository.model.ModelDatasetMappRepository;
|
import com.kamco.cd.training.postgres.repository.model.ModelDatasetMappRepository;
|
||||||
import com.kamco.cd.training.postgres.repository.model.ModelMngRepository;
|
import com.kamco.cd.training.postgres.repository.model.ModelMngRepository;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
public class ModelMngCoreService {
|
public class ModelMngCoreService {
|
||||||
private final ModelMngRepository modelMngRepository;
|
private final ModelMngRepository modelMngRepository;
|
||||||
private final ModelDatasetMappRepository modelDatasetMappRepository;
|
private final ModelDatasetMappRepository modelDatasetMappRepository;
|
||||||
|
private final UserUtil userUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 모델 목록 조회
|
* 모델 목록 조회
|
||||||
@@ -30,16 +32,23 @@ public class ModelMngCoreService {
|
|||||||
* @return 페이징 처리된 모델 목록
|
* @return 페이징 처리된 모델 목록
|
||||||
*/
|
*/
|
||||||
public Page<Basic> findByModelList(ModelMngDto.SearchReq searchReq) {
|
public Page<Basic> findByModelList(ModelMngDto.SearchReq searchReq) {
|
||||||
Page<ModelTrainMasterEntity> entityPage = modelMngRepository.findByModels(searchReq);
|
Page<ModelMasterEntity> entityPage = modelMngRepository.findByModels(searchReq);
|
||||||
return entityPage.map(ModelTrainMasterEntity::toDto);
|
return entityPage.map(ModelMasterEntity::toDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 학습모델 삭제
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
*/
|
||||||
public void deleteModel(UUID uuid) {
|
public void deleteModel(UUID uuid) {
|
||||||
ModelTrainMasterEntity entity =
|
ModelMasterEntity entity =
|
||||||
modelMngRepository
|
modelMngRepository
|
||||||
.findByUuid(uuid)
|
.findByUuid(uuid)
|
||||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||||
// entity.setDelYn();
|
entity.setDelYn(true);
|
||||||
|
entity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
|
entity.setUpdatedUid(userUtil.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,7 +58,7 @@ public class ModelMngCoreService {
|
|||||||
* @return 모델 상세 정보
|
* @return 모델 상세 정보
|
||||||
*/
|
*/
|
||||||
public ModelMngDto.Detail getModelDetail(Long modelUid) {
|
public ModelMngDto.Detail getModelDetail(Long modelUid) {
|
||||||
ModelTrainMasterEntity entity =
|
ModelMasterEntity entity =
|
||||||
modelMngRepository
|
modelMngRepository
|
||||||
.findById(modelUid)
|
.findById(modelUid)
|
||||||
.orElseThrow(() -> new NotFoundException("모델을 찾을 수 없습니다. ID: " + modelUid));
|
.orElseThrow(() -> new NotFoundException("모델을 찾을 수 없습니다. ID: " + modelUid));
|
||||||
@@ -58,68 +67,27 @@ public class ModelMngCoreService {
|
|||||||
throw new NotFoundException("삭제된 모델입니다. ID: " + modelUid);
|
throw new NotFoundException("삭제된 모델입니다. ID: " + modelUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ModelMngDto.Detail.builder()
|
return null;
|
||||||
.uuid(entity.getUuid().toString())
|
// ModelMngDto.Detail.builder()
|
||||||
.modelVer(entity.getModelVer())
|
// .uuid(entity.getUuid().toString())
|
||||||
.epochVer(entity.getEpochVer())
|
// .modelVer(entity.getModelVer())
|
||||||
.processStep(entity.getProcessStep())
|
// .epochVer(entity.getEpochVer())
|
||||||
.trainStartDttm(entity.getTrainStartDttm())
|
// .processStep(entity.getProcessStep())
|
||||||
.epochCnt(entity.getEpochCnt())
|
// .trainStartDttm(entity.getTrainStartDttm())
|
||||||
.datasetRatio(entity.getDatasetRatio())
|
// .epochCnt(entity.getEpochCnt())
|
||||||
.bestEpoch(entity.getBestEpoch())
|
// .datasetRatio(entity.getDatasetRatio())
|
||||||
.confirmedBestEpoch(entity.getConfirmedBestEpoch())
|
// .bestEpoch(entity.getBestEpoch())
|
||||||
.step1EndDttm(entity.getStep1EndDttm())
|
// .confirmedBestEpoch(entity.getConfirmedBestEpoch())
|
||||||
.step1Duration(entity.getStep1Duration())
|
// .step1EndDttm(entity.getStep1EndDttm())
|
||||||
.step2EndDttm(entity.getStep2EndDttm())
|
// .step1Duration(entity.getStep1Duration())
|
||||||
.step2Duration(entity.getStep2Duration())
|
// .step2EndDttm(entity.getStep2EndDttm())
|
||||||
.progressRate(entity.getProgressRate())
|
// .step2Duration(entity.getStep2Duration())
|
||||||
.createdDttm(entity.getCreatedDttm())
|
// .progressRate(entity.getProgressRate())
|
||||||
.updatedDttm(entity.getUpdatedDttm())
|
// .createdDttm(entity.getCreatedDttm())
|
||||||
.modelPath(entity.getModelPath())
|
// .updatedDttm(entity.getUpdatedDttm())
|
||||||
.errorMsg(entity.getErrorMsg())
|
// .modelPath(entity.getModelPath())
|
||||||
.build();
|
// .errorMsg(entity.getErrorMsg())
|
||||||
}
|
// .build();
|
||||||
|
|
||||||
/**
|
|
||||||
* 모델 상세 조회 (UUID 기반)
|
|
||||||
*
|
|
||||||
* @param uuid 모델 UUID
|
|
||||||
* @return 모델 상세 정보
|
|
||||||
*/
|
|
||||||
public ModelMngDto.Detail getModelDetailByUuid(String uuid) {
|
|
||||||
ModelTrainMasterEntity entity = findByUuid(uuid);
|
|
||||||
return getModelDetail(entity.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 학습 모델 전체 목록 조회 (삭제되지 않은 것만)
|
|
||||||
*
|
|
||||||
* @return 학습 모델 목록
|
|
||||||
*/
|
|
||||||
public List<ModelMngDto.TrainListRes> findAllTrainModels() {
|
|
||||||
List<ModelTrainMasterEntity> entities =
|
|
||||||
modelMngRepository.findByDelYnOrderByCreatedDttmDesc(false);
|
|
||||||
|
|
||||||
return entities.stream()
|
|
||||||
.map(
|
|
||||||
entity ->
|
|
||||||
ModelMngDto.TrainListRes.builder()
|
|
||||||
.uuid(entity.getUuid().toString())
|
|
||||||
.modelVer(entity.getModelVer())
|
|
||||||
.processStep(entity.getProcessStep())
|
|
||||||
.trainStartDttm(entity.getTrainStartDttm())
|
|
||||||
.progressRate(entity.getProgressRate())
|
|
||||||
.epochCnt(entity.getEpochCnt())
|
|
||||||
.step1EndDttm(entity.getStep1EndDttm())
|
|
||||||
.step1Duration(entity.getStep1Duration())
|
|
||||||
.step2EndDttm(entity.getStep2EndDttm())
|
|
||||||
.step2Duration(entity.getStep2Duration())
|
|
||||||
.createdDttm(entity.getCreatedDttm())
|
|
||||||
.errorMsg(entity.getErrorMsg())
|
|
||||||
.canResume(entity.getCanResume())
|
|
||||||
.lastCheckpointEpoch(entity.getLastCheckpointEpoch())
|
|
||||||
.build())
|
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,19 +108,19 @@ public class ModelMngCoreService {
|
|||||||
* @param trainReq 학습 시작 요청
|
* @param trainReq 학습 시작 요청
|
||||||
* @return 생성된 모델 Entity
|
* @return 생성된 모델 Entity
|
||||||
*/
|
*/
|
||||||
public ModelTrainMasterEntity createTrainMaster(ModelMngDto.TrainStartReq trainReq) {
|
public ModelMasterEntity createTrainMaster(ModelMngDto.TrainStartReq trainReq) {
|
||||||
ModelTrainMasterEntity entity = new ModelTrainMasterEntity();
|
// ModelMasterEntity entity = new ModelMasterEntity();
|
||||||
entity.setModelVer(trainReq.getHyperVer());
|
// entity.setModelVer(trainReq.getHyperVer());
|
||||||
entity.setEpochVer(String.valueOf(trainReq.getEpoch()));
|
// entity.setEpochVer(String.valueOf(trainReq.getEpoch()));
|
||||||
entity.setProcessStep("STEP1");
|
// entity.setProcessStep("STEP1");
|
||||||
entity.setTrainStartDttm(ZonedDateTime.now());
|
// entity.setTrainStartDttm(ZonedDateTime.now());
|
||||||
entity.setEpochCnt(trainReq.getEpoch());
|
// entity.setEpochCnt(trainReq.getEpoch());
|
||||||
entity.setDatasetRatio(trainReq.getDatasetRatio());
|
// entity.setDatasetRatio(trainReq.getDatasetRatio());
|
||||||
entity.setDelYn(false);
|
// entity.setDelYn(false);
|
||||||
entity.setCreatedDttm(ZonedDateTime.now());
|
// entity.setCreatedDttm(ZonedDateTime.now());
|
||||||
entity.setProgressRate(0);
|
// entity.setProgressRate(0);
|
||||||
|
|
||||||
return modelMngRepository.save(entity);
|
return null; // modelMngRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,7 +145,7 @@ public class ModelMngCoreService {
|
|||||||
* @param uuid UUID
|
* @param uuid UUID
|
||||||
* @return 모델 Entity
|
* @return 모델 Entity
|
||||||
*/
|
*/
|
||||||
public ModelTrainMasterEntity findByUuid(String uuid) {
|
public ModelMasterEntity findByUuid(String uuid) {
|
||||||
try {
|
try {
|
||||||
java.util.UUID uuidObj = java.util.UUID.fromString(uuid);
|
java.util.UUID uuidObj = java.util.UUID.fromString(uuid);
|
||||||
return modelMngRepository
|
return modelMngRepository
|
||||||
@@ -187,22 +155,4 @@ public class ModelMngCoreService {
|
|||||||
throw new BadRequestException("잘못된 UUID 형식입니다: " + uuid);
|
throw new BadRequestException("잘못된 UUID 형식입니다: " + uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 모델 삭제 (논리 삭제)
|
|
||||||
*
|
|
||||||
* @param uuid UUID
|
|
||||||
*/
|
|
||||||
public void deleteByUuid(String uuid) {
|
|
||||||
ModelTrainMasterEntity entity = findByUuid(uuid);
|
|
||||||
|
|
||||||
// 진행 중인 모델은 삭제 불가
|
|
||||||
// if ("RUNNING".equals(entity.getStatusCd())) {
|
|
||||||
// throw new BadRequestException("진행 중인 모델은 삭제할 수 없습니다.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
entity.setDelYn(true);
|
|
||||||
entity.setUpdatedDttm(ZonedDateTime.now());
|
|
||||||
modelMngRepository.save(entity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.kamco.cd.training.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_model_config")
|
||||||
|
public class ModelConfigEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "config_id", nullable = false)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
|
@JoinColumn(name = "model_id", nullable = false)
|
||||||
|
private ModelMasterEntity model;
|
||||||
|
|
||||||
|
@Column(name = "epoch_count")
|
||||||
|
private Integer epochCount;
|
||||||
|
|
||||||
|
@Column(name = "train_percent")
|
||||||
|
private Float trainPercent;
|
||||||
|
|
||||||
|
@Column(name = "validation_percent")
|
||||||
|
private Float validationPercent;
|
||||||
|
|
||||||
|
@Column(name = "test_percent")
|
||||||
|
private Float testPercent;
|
||||||
|
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "created_dttm")
|
||||||
|
private OffsetDateTime createdDttm;
|
||||||
|
|
||||||
|
@Column(name = "created_uid")
|
||||||
|
private Long createdUid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.kamco.cd.training.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_model_dataset")
|
||||||
|
public class ModelDatasetEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "id", nullable = false)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
|
@JoinColumn(name = "model_id", nullable = false)
|
||||||
|
private ModelMasterEntity model;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "data_id", nullable = false)
|
||||||
|
private Long dataId;
|
||||||
|
|
||||||
|
@Column(name = "building_cnt")
|
||||||
|
private Long buildingCnt;
|
||||||
|
|
||||||
|
@Column(name = "container_cnt")
|
||||||
|
private Long containerCnt;
|
||||||
|
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "created_dttm")
|
||||||
|
private OffsetDateTime createdDttm;
|
||||||
|
|
||||||
|
@Column(name = "created_uid")
|
||||||
|
private Long createdUid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.kamco.cd.training.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_model_history")
|
||||||
|
public class ModelHistoryEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "hst_id", nullable = false)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
|
@JoinColumn(name = "model_id", nullable = false)
|
||||||
|
private ModelMasterEntity model;
|
||||||
|
|
||||||
|
@Column(name = "model_no")
|
||||||
|
private Short modelNo;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "model_ver", length = 50)
|
||||||
|
private String modelVer;
|
||||||
|
|
||||||
|
@Column(name = "model_step")
|
||||||
|
private Short modelStep;
|
||||||
|
|
||||||
|
@Column(name = "step1_strt_dttm")
|
||||||
|
private OffsetDateTime step1StrtDttm;
|
||||||
|
|
||||||
|
@Column(name = "step1_end_dttm")
|
||||||
|
private OffsetDateTime step1EndDttm;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "step1_state", length = 20)
|
||||||
|
private String step1State;
|
||||||
|
|
||||||
|
@Column(name = "step2_strt_dttm")
|
||||||
|
private OffsetDateTime step2StrtDttm;
|
||||||
|
|
||||||
|
@Column(name = "step2_end_dttm")
|
||||||
|
private OffsetDateTime step2EndDttm;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "step2_state", length = 20)
|
||||||
|
private String step2State;
|
||||||
|
|
||||||
|
@Column(name = "error_msg", length = Integer.MAX_VALUE)
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "created_dttm")
|
||||||
|
private OffsetDateTime createdDttm;
|
||||||
|
|
||||||
|
@Column(name = "created_uid")
|
||||||
|
private Long createdUid;
|
||||||
|
}
|
||||||
@@ -5,8 +5,6 @@ import jakarta.persistence.*;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -313,9 +311,6 @@ public class ModelHyperParamEntity {
|
|||||||
@Column(name = "m3_use_cnt")
|
@Column(name = "m3_use_cnt")
|
||||||
private Long m3UseCnt = 0L;
|
private Long m3UseCnt = 0L;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "hyperParams", fetch = FetchType.LAZY)
|
|
||||||
private Set<ModelTrainMasterEntity> trainMasters = new LinkedHashSet<>();
|
|
||||||
|
|
||||||
public HyperParamDto.Basic toDto() {
|
public HyperParamDto.Basic toDto() {
|
||||||
return new HyperParamDto.Basic(
|
return new HyperParamDto.Basic(
|
||||||
this.uuid,
|
this.uuid,
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package com.kamco.cd.training.postgres.entity;
|
||||||
|
|
||||||
|
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_model_master")
|
||||||
|
public class ModelMasterEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "model_id", nullable = false)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "hyper_param_id", nullable = false)
|
||||||
|
private Long hyperParamId;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "model_no", length = 10)
|
||||||
|
private String modelNo;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "model_ver", length = 50)
|
||||||
|
private String modelVer;
|
||||||
|
|
||||||
|
@Column(name = "model_step")
|
||||||
|
private Short modelStep;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "status_cd", length = 20)
|
||||||
|
private String statusCd;
|
||||||
|
|
||||||
|
@Column(name = "strt_dttm")
|
||||||
|
private ZonedDateTime strtDttm;
|
||||||
|
|
||||||
|
@Column(name = "step1_strt_dttm")
|
||||||
|
private ZonedDateTime step1StrtDttm;
|
||||||
|
|
||||||
|
@Column(name = "step1_end_dttm")
|
||||||
|
private ZonedDateTime step1EndDttm;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "step1_state", length = 20)
|
||||||
|
private String step1State;
|
||||||
|
|
||||||
|
@Column(name = "step2_strt_dttm")
|
||||||
|
private ZonedDateTime step2StrtDttm;
|
||||||
|
|
||||||
|
@Column(name = "step2_end_dttm")
|
||||||
|
private ZonedDateTime step2EndDttm;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "step2_state", length = 20)
|
||||||
|
private String step2State;
|
||||||
|
|
||||||
|
@Column(name = "del_yn")
|
||||||
|
private Boolean delYn;
|
||||||
|
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "created_dttm")
|
||||||
|
private ZonedDateTime createdDttm = ZonedDateTime.now();
|
||||||
|
|
||||||
|
@Column(name = "created_uid")
|
||||||
|
private Long createdUid;
|
||||||
|
|
||||||
|
@Column(name = "updated_dttm")
|
||||||
|
private ZonedDateTime updatedDttm;
|
||||||
|
|
||||||
|
@Column(name = "updated_uid")
|
||||||
|
private Long updatedUid;
|
||||||
|
|
||||||
|
@Column(name = "uuid")
|
||||||
|
private UUID uuid = UUID.randomUUID();
|
||||||
|
|
||||||
|
@Column(name = "train_type")
|
||||||
|
private String trainType;
|
||||||
|
|
||||||
|
public ModelMngDto.Basic toDto() {
|
||||||
|
return new ModelMngDto.Basic(
|
||||||
|
this.id,
|
||||||
|
this.uuid,
|
||||||
|
this.modelVer,
|
||||||
|
this.strtDttm,
|
||||||
|
this.step1StrtDttm,
|
||||||
|
this.step1EndDttm,
|
||||||
|
this.step2StrtDttm,
|
||||||
|
this.step2EndDttm,
|
||||||
|
this.step1State,
|
||||||
|
this.step2State,
|
||||||
|
this.statusCd,
|
||||||
|
this.trainType);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.kamco.cd.training.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_model_matrics_test")
|
||||||
|
public class ModelMatricsTestEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "mtrc_id", nullable = false)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
|
@JoinColumn(name = "model_id", nullable = false)
|
||||||
|
private ModelMasterEntity model;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "model", length = 50)
|
||||||
|
private String model1;
|
||||||
|
|
||||||
|
@Column(name = "tp")
|
||||||
|
private Long tp;
|
||||||
|
|
||||||
|
@Column(name = "fp")
|
||||||
|
private Long fp;
|
||||||
|
|
||||||
|
@Column(name = "fn")
|
||||||
|
private Long fn;
|
||||||
|
|
||||||
|
@Column(name = "tn")
|
||||||
|
private Long tn;
|
||||||
|
|
||||||
|
@Column(name = "precisions")
|
||||||
|
private Float precisions;
|
||||||
|
|
||||||
|
@Column(name = "recall")
|
||||||
|
private Float recall;
|
||||||
|
|
||||||
|
@Column(name = "f1_score")
|
||||||
|
private Float f1Score;
|
||||||
|
|
||||||
|
@Column(name = "accuracy")
|
||||||
|
private Float accuracy;
|
||||||
|
|
||||||
|
@Column(name = "iou")
|
||||||
|
private Float iou;
|
||||||
|
|
||||||
|
@Column(name = "processed_images")
|
||||||
|
private Long processedImages;
|
||||||
|
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "created_dttm")
|
||||||
|
private OffsetDateTime createdDttm;
|
||||||
|
|
||||||
|
@Column(name = "created_uid")
|
||||||
|
private Long createdUid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.kamco.cd.training.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_model_matrics_train")
|
||||||
|
public class ModelMatricsTrainEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "mtrc_id", nullable = false)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
|
@JoinColumn(name = "model_id", nullable = false)
|
||||||
|
private ModelMasterEntity model;
|
||||||
|
|
||||||
|
@Column(name = "epoch")
|
||||||
|
private Integer epoch;
|
||||||
|
|
||||||
|
@Column(name = "iteration")
|
||||||
|
private Long iteration;
|
||||||
|
|
||||||
|
@Column(name = "loss")
|
||||||
|
private Double loss;
|
||||||
|
|
||||||
|
@Column(name = "lr")
|
||||||
|
private Double lr;
|
||||||
|
|
||||||
|
@Column(name = "duration_time")
|
||||||
|
private Float durationTime;
|
||||||
|
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "created_dttm")
|
||||||
|
private OffsetDateTime createdDttm;
|
||||||
|
|
||||||
|
@Column(name = "created_uid")
|
||||||
|
private Long createdUid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.kamco.cd.training.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_model_matrics_validation")
|
||||||
|
public class ModelMatricsValidationEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "mtrc_id", nullable = false)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
|
@JoinColumn(name = "model_id", nullable = false)
|
||||||
|
private ModelMasterEntity model;
|
||||||
|
|
||||||
|
@Column(name = "epoch")
|
||||||
|
private Integer epoch;
|
||||||
|
|
||||||
|
@Column(name = "a_acc")
|
||||||
|
private Float aAcc;
|
||||||
|
|
||||||
|
@Column(name = "m_fscore")
|
||||||
|
private Float mFscore;
|
||||||
|
|
||||||
|
@Column(name = "m_precision")
|
||||||
|
private Float mPrecision;
|
||||||
|
|
||||||
|
@Column(name = "m_recall")
|
||||||
|
private Float mRecall;
|
||||||
|
|
||||||
|
@Column(name = "m_iou")
|
||||||
|
private Float mIou;
|
||||||
|
|
||||||
|
@Column(name = "m_acc")
|
||||||
|
private Float mAcc;
|
||||||
|
|
||||||
|
@Column(name = "changed_fscore")
|
||||||
|
private Float changedFscore;
|
||||||
|
|
||||||
|
@Column(name = "changed_precision")
|
||||||
|
private Float changedPrecision;
|
||||||
|
|
||||||
|
@Column(name = "changed_recall")
|
||||||
|
private Float changedRecall;
|
||||||
|
|
||||||
|
@Column(name = "unchanged_fscore")
|
||||||
|
private Float unchangedFscore;
|
||||||
|
|
||||||
|
@Column(name = "unchanged_precision")
|
||||||
|
private Float unchangedPrecision;
|
||||||
|
|
||||||
|
@Column(name = "unchanged_recall")
|
||||||
|
private Float unchangedRecall;
|
||||||
|
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "created_dttm")
|
||||||
|
private OffsetDateTime createdDttm;
|
||||||
|
|
||||||
|
@Column(name = "created_uid")
|
||||||
|
private Long createdUid;
|
||||||
|
}
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
package com.kamco.cd.training.postgres.entity;
|
|
||||||
|
|
||||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.FetchType;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.JoinColumn;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.UUID;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
|
||||||
import org.hibernate.annotations.OnDelete;
|
|
||||||
import org.hibernate.annotations.OnDeleteAction;
|
|
||||||
import org.hibernate.annotations.UuidGenerator;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_train_master")
|
|
||||||
public class ModelTrainMasterEntity {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "model_uid", nullable = false)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "model_ver", nullable = false, length = 50)
|
|
||||||
private String modelVer;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "hyper_ver", length = 50)
|
|
||||||
private String hyperVer;
|
|
||||||
|
|
||||||
/** tb_model_train_master.hyper_param_id -> tb_model_hyper_params.hyper_param_id */
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "hyper_param_id", nullable = false)
|
|
||||||
private Long hyperParamId;
|
|
||||||
|
|
||||||
/** - hyperParamId 컬럼으로 저장/수정하고 - 객체로 조회할 때만 hyperParams 사용 */
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
|
||||||
@JoinColumn(
|
|
||||||
name = "hyper_param_id",
|
|
||||||
referencedColumnName = "hyper_param_id",
|
|
||||||
insertable = false,
|
|
||||||
updatable = false)
|
|
||||||
private ModelHyperParamEntity hyperParams;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "epoch_ver", length = 50)
|
|
||||||
private String epochVer;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "process_step", length = 50)
|
|
||||||
private String processStep;
|
|
||||||
|
|
||||||
@Column(name = "train_start_dttm")
|
|
||||||
private ZonedDateTime trainStartDttm;
|
|
||||||
|
|
||||||
@Column(name = "epoch_cnt")
|
|
||||||
private Integer epochCnt;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "dataset_ratio", length = 50)
|
|
||||||
private String datasetRatio;
|
|
||||||
|
|
||||||
@Column(name = "best_epoch")
|
|
||||||
private Integer bestEpoch;
|
|
||||||
|
|
||||||
@Column(name = "step1_end_dttm")
|
|
||||||
private ZonedDateTime step1EndDttm;
|
|
||||||
|
|
||||||
@Column(name = "step1_duration")
|
|
||||||
private ZonedDateTime step1Duration;
|
|
||||||
|
|
||||||
@Column(name = "step2_end_dttm")
|
|
||||||
private ZonedDateTime step2EndDttm;
|
|
||||||
|
|
||||||
@Column(name = "step2_duration")
|
|
||||||
private ZonedDateTime step2Duration;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ColumnDefault("false")
|
|
||||||
@Column(name = "del_yn", nullable = false)
|
|
||||||
private Boolean delYn = false;
|
|
||||||
|
|
||||||
@Column(name = "created_uid")
|
|
||||||
private Long createdUid;
|
|
||||||
|
|
||||||
@Column(name = "updated_uid")
|
|
||||||
private Long updatedUid;
|
|
||||||
|
|
||||||
@ColumnDefault("now()")
|
|
||||||
@Column(name = "created_dttm")
|
|
||||||
private ZonedDateTime createdDttm;
|
|
||||||
|
|
||||||
@Column(name = "updated_dttm")
|
|
||||||
private ZonedDateTime updatedDttm;
|
|
||||||
|
|
||||||
@ColumnDefault("0")
|
|
||||||
@Column(name = "progress_rate")
|
|
||||||
private Integer progressRate;
|
|
||||||
|
|
||||||
@Column(name = "stop_dttm")
|
|
||||||
private ZonedDateTime stopDttm;
|
|
||||||
|
|
||||||
@Column(name = "confirmed_best_epoch")
|
|
||||||
private Integer confirmedBestEpoch;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@Column(name = "model_path")
|
|
||||||
private String modelPath;
|
|
||||||
|
|
||||||
@Column(name = "error_msg")
|
|
||||||
private String errorMsg;
|
|
||||||
|
|
||||||
@Column(name = "step2_start_dttm")
|
|
||||||
private ZonedDateTime step2StartDttm;
|
|
||||||
|
|
||||||
@Size(max = 1000)
|
|
||||||
@Column(name = "train_log_path", length = 1000)
|
|
||||||
private String trainLogPath;
|
|
||||||
|
|
||||||
@Column(name = "memo")
|
|
||||||
private String memo;
|
|
||||||
|
|
||||||
/** 기존 자기참조(base_model_uid)는 유지 */
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
|
||||||
@OnDelete(action = OnDeleteAction.SET_NULL)
|
|
||||||
@JoinColumn(name = "base_model_uid")
|
|
||||||
private ModelTrainMasterEntity baseModel;
|
|
||||||
|
|
||||||
@Size(max = 1000)
|
|
||||||
@Column(name = "pretrained_model_path", length = 1000)
|
|
||||||
private String pretrainedModelPath;
|
|
||||||
|
|
||||||
@Column(name = "last_checkpoint_epoch")
|
|
||||||
private Integer lastCheckpointEpoch;
|
|
||||||
|
|
||||||
@Size(max = 500)
|
|
||||||
@Column(name = "checkpoint_path", length = 500)
|
|
||||||
private String checkpointPath;
|
|
||||||
|
|
||||||
@Column(name = "can_resume")
|
|
||||||
private Boolean canResume;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@UuidGenerator
|
|
||||||
@Column(name = "uuid", nullable = false, updatable = false)
|
|
||||||
private UUID uuid = UUID.randomUUID();
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "step1_status", length = 10)
|
|
||||||
private String step1Status;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "step2_status", length = 10)
|
|
||||||
private String step2Status;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "transfer_status", length = 10)
|
|
||||||
private String transferStatus;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "status_cd", length = 10)
|
|
||||||
private String statusCd;
|
|
||||||
|
|
||||||
public ModelMngDto.Basic toDto() {
|
|
||||||
return new ModelMngDto.Basic(
|
|
||||||
this.id,
|
|
||||||
this.uuid,
|
|
||||||
this.modelVer,
|
|
||||||
this.trainStartDttm,
|
|
||||||
this.step1EndDttm,
|
|
||||||
this.step1Duration,
|
|
||||||
this.step2EndDttm,
|
|
||||||
this.step2Duration,
|
|
||||||
this.step1Status,
|
|
||||||
this.step2Status,
|
|
||||||
this.transferStatus,
|
|
||||||
this.statusCd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,7 @@
|
|||||||
package com.kamco.cd.training.postgres.repository.model;
|
package com.kamco.cd.training.postgres.repository.model;
|
||||||
|
|
||||||
import com.kamco.cd.training.postgres.entity.ModelTrainMasterEntity;
|
import com.kamco.cd.training.postgres.entity.ModelMasterEntity;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface ModelMngRepository
|
public interface ModelMngRepository
|
||||||
extends JpaRepository<ModelTrainMasterEntity, Long>, ModelMngRepositoryCustom {
|
extends JpaRepository<ModelMasterEntity, Long>, ModelMngRepositoryCustom {}
|
||||||
|
|
||||||
List<ModelTrainMasterEntity> findByDelYnOrderByCreatedDttmDesc(Boolean delYn);
|
|
||||||
|
|
||||||
Optional<ModelTrainMasterEntity> findFirstByStatusCdAndDelYn(String statusCd, Boolean delYn);
|
|
||||||
|
|
||||||
Optional<ModelTrainMasterEntity> findByUuid(UUID uuid);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.kamco.cd.training.postgres.repository.model;
|
package com.kamco.cd.training.postgres.repository.model;
|
||||||
|
|
||||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.training.postgres.entity.ModelTrainMasterEntity;
|
import com.kamco.cd.training.postgres.entity.ModelMasterEntity;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -14,7 +14,9 @@ public interface ModelMngRepositoryCustom {
|
|||||||
* @param searchReq
|
* @param searchReq
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Page<ModelTrainMasterEntity> findByModels(ModelMngDto.SearchReq searchReq);
|
Page<ModelMasterEntity> findByModels(ModelMngDto.SearchReq searchReq);
|
||||||
|
|
||||||
Optional<ModelTrainMasterEntity> findByUuid(UUID uuid);
|
Optional<ModelMasterEntity> findByUuid(UUID uuid);
|
||||||
|
|
||||||
|
Optional<ModelMasterEntity> findFirstByStatusCdAndDelYn(String statusCd, Boolean delYn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.kamco.cd.training.postgres.repository.model;
|
package com.kamco.cd.training.postgres.repository.model;
|
||||||
|
|
||||||
import static com.kamco.cd.training.postgres.entity.QModelTrainMasterEntity.modelTrainMasterEntity;
|
import static com.kamco.cd.training.postgres.entity.QModelMasterEntity.modelMasterEntity;
|
||||||
|
|
||||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.training.postgres.entity.ModelTrainMasterEntity;
|
import com.kamco.cd.training.postgres.entity.ModelMasterEntity;
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -28,28 +28,28 @@ public class ModelMngRepositoryImpl implements ModelMngRepositoryCustom {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<ModelTrainMasterEntity> findByModels(ModelMngDto.SearchReq req) {
|
public Page<ModelMasterEntity> findByModels(ModelMngDto.SearchReq req) {
|
||||||
Pageable pageable = req.toPageable();
|
Pageable pageable = req.toPageable();
|
||||||
BooleanBuilder builder = new BooleanBuilder();
|
BooleanBuilder builder = new BooleanBuilder();
|
||||||
|
|
||||||
if (req.getStatus() != null && !req.getStatus().isEmpty()) {
|
if (req.getStatus() != null && !req.getStatus().isEmpty()) {
|
||||||
builder.and(modelTrainMasterEntity.statusCd.eq(req.getStatus()));
|
builder.and(modelMasterEntity.statusCd.eq(req.getStatus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ModelTrainMasterEntity> content =
|
List<ModelMasterEntity> content =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(modelTrainMasterEntity)
|
.selectFrom(modelMasterEntity)
|
||||||
.where(builder)
|
.where(builder)
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.orderBy(modelTrainMasterEntity.createdDttm.desc())
|
.orderBy(modelMasterEntity.createdDttm.desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
// Count 쿼리 별도 실행 (null safe handling)
|
// Count 쿼리 별도 실행 (null safe handling)
|
||||||
Long total =
|
Long total =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(modelTrainMasterEntity.count())
|
.select(modelMasterEntity.count())
|
||||||
.from(modelTrainMasterEntity)
|
.from(modelMasterEntity)
|
||||||
.where(builder)
|
.where(builder)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
@@ -65,12 +65,17 @@ public class ModelMngRepositoryImpl implements ModelMngRepositoryCustom {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<ModelTrainMasterEntity> findByUuid(UUID uuid) {
|
public Optional<ModelMasterEntity> findByUuid(UUID uuid) {
|
||||||
return Optional.ofNullable(
|
return Optional.ofNullable(
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(modelTrainMasterEntity)
|
.select(modelMasterEntity)
|
||||||
.from(modelTrainMasterEntity)
|
.from(modelMasterEntity)
|
||||||
.where(modelTrainMasterEntity.uuid.eq(uuid))
|
.where(modelMasterEntity.uuid.eq(uuid))
|
||||||
.fetchOne());
|
.fetchOne());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<ModelMasterEntity> findFirstByStatusCdAndDelYn(String statusCd, Boolean delYn) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user