hyperparam_with_modeltype

This commit is contained in:
2026-02-12 19:16:13 +09:00
parent b0cf9e77ec
commit 5455da1e96
4 changed files with 169 additions and 176 deletions

View File

@@ -101,8 +101,9 @@ public class HyperParamApiController {
LocalDate endDate, LocalDate endDate,
@Parameter(description = "버전명", example = "G_000001") @RequestParam(required = false) @Parameter(description = "버전명", example = "G_000001") @RequestParam(required = false)
String hyperVer, String hyperVer,
@Parameter(description = "버전명", example = "G1,G2,G3") @RequestParam(required = false) ModelType model @Parameter(description = "버전명", example = "G1,G2,G3") @RequestParam(required = false)
, @Parameter( ModelType model,
@Parameter(
description = "정렬", description = "정렬",
example = "createdDttm desc", example = "createdDttm desc",
schema = schema =

View File

@@ -104,10 +104,10 @@ public class HyperParamCoreService {
*/ */
public HyperParamDto.Basic getInitHyperParam(ModelType model) { public HyperParamDto.Basic getInitHyperParam(ModelType model) {
ModelHyperParamEntity entity = ModelHyperParamEntity entity =
hyperParamRepository hyperParamRepository.getHyperparamByType(model).stream()
.getHyperparamByType(model) .filter(e -> e.getIsDefault() == Boolean.TRUE)
.stream().filter(e -> e.getIsDefault() == Boolean.TRUE) .findFirst()
.findFirst().orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND)); .orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
return entity.toDto(); return entity.toDto();
} }

View File

@@ -86,10 +86,11 @@ public class ModelTrainMngCoreService {
// 최적화 파라미터는 모델 type의 디폴트사용 // 최적화 파라미터는 모델 type의 디폴트사용
if (HyperParamSelectType.OPTIMIZED.getId().equals(addReq.getHyperParamType())) { if (HyperParamSelectType.OPTIMIZED.getId().equals(addReq.getHyperParamType())) {
ModelType modelType = ModelType.getValueData(addReq.getModelNo()); ModelType modelType = ModelType.getValueData(addReq.getModelNo());
hyperParamEntity = hyperParamRepository.getHyperparamByType(modelType) hyperParamEntity =
.stream() hyperParamRepository.getHyperparamByType(modelType).stream()
.filter(e -> e.getIsDefault() == Boolean.TRUE) .filter(e -> e.getIsDefault() == Boolean.TRUE)
.findFirst().orElse(null); .findFirst()
.orElse(null);
// hyperParamEntity = hyperParamRepository.findByHyperVer("HPs_0001").orElse(null); // hyperParamEntity = hyperParamRepository.findByHyperVer("HPs_0001").orElse(null);
} else { } else {
@@ -310,9 +311,7 @@ public class ModelTrainMngCoreService {
return entity.toDto(); return entity.toDto();
} }
/** /** 마스터를 IN_PROGRESS로 전환하고, 현재 실행 jobId를 연결 - UI/중단/상태조회 모두 currentAttemptId를 기준으로 동작 */
* 마스터를 IN_PROGRESS로 전환하고, 현재 실행 jobId를 연결 - UI/중단/상태조회 모두 currentAttemptId를 기준으로 동작
*/
@Transactional @Transactional
public void markInProgress(Long modelId, Long jobId) { public void markInProgress(Long modelId, Long jobId) {
ModelMasterEntity master = ModelMasterEntity master =
@@ -326,9 +325,7 @@ public class ModelTrainMngCoreService {
// 필요하면 시작시간도 여기서 찍어줌 // 필요하면 시작시간도 여기서 찍어줌
} }
/** /** 마지막 에러 메시지 초기화 - 재시작/새 실행 때 이전 에러 흔적 제거 */
* 마지막 에러 메시지 초기화 - 재시작/새 실행 때 이전 에러 흔적 제거
*/
@Transactional @Transactional
public void clearLastError(Long modelId) { public void clearLastError(Long modelId) {
ModelMasterEntity master = ModelMasterEntity master =
@@ -339,9 +336,7 @@ public class ModelTrainMngCoreService {
master.setLastError(null); master.setLastError(null);
} }
/** /** 중단 처리(옵션) - cancel에서 쓰려고 하면 같이 구현 */
* 중단 처리(옵션) - cancel에서 쓰려고 하면 같이 구현
*/
@Transactional @Transactional
public void markStopped(Long modelId) { public void markStopped(Long modelId) {
ModelMasterEntity master = ModelMasterEntity master =
@@ -352,9 +347,7 @@ public class ModelTrainMngCoreService {
master.setStatusCd(TrainStatusType.STOPPED.getId()); master.setStatusCd(TrainStatusType.STOPPED.getId());
} }
/** /** 완료 처리(옵션) - Worker가 성공 시 호출 */
* 완료 처리(옵션) - Worker가 성공 시 호출
*/
@Transactional @Transactional
public void markCompleted(Long modelId) { public void markCompleted(Long modelId) {
ModelMasterEntity master = ModelMasterEntity master =
@@ -365,9 +358,7 @@ public class ModelTrainMngCoreService {
master.setStatusCd(TrainStatusType.COMPLETED.getId()); master.setStatusCd(TrainStatusType.COMPLETED.getId());
} }
/** /** step 1오류 처리(옵션) - Worker가 실패 시 호출 */
* step 1오류 처리(옵션) - Worker가 실패 시 호출
*/
@Transactional @Transactional
public void markError(Long modelId, String errorMessage) { public void markError(Long modelId, String errorMessage) {
ModelMasterEntity master = ModelMasterEntity master =
@@ -382,9 +373,7 @@ public class ModelTrainMngCoreService {
master.setUpdatedDttm(ZonedDateTime.now()); master.setUpdatedDttm(ZonedDateTime.now());
} }
/** /** step 2오류 처리(옵션) - Worker가 실패 시 호출 */
* step 2오류 처리(옵션) - Worker가 실패 시 호출
*/
@Transactional @Transactional
public void markStep2Error(Long modelId, String errorMessage) { public void markStep2Error(Long modelId, String errorMessage) {
ModelMasterEntity master = ModelMasterEntity master =

View File

@@ -152,12 +152,14 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
boolean asc = sortOrder.isAscending(); boolean asc = sortOrder.isAscending();
switch (property) { switch (property) {
case "createdDttm" -> query.orderBy( case "createdDttm" ->
query.orderBy(
asc asc
? modelHyperParamEntity.createdDttm.asc() ? modelHyperParamEntity.createdDttm.asc()
: modelHyperParamEntity.createdDttm.desc()); : modelHyperParamEntity.createdDttm.desc());
case "lastUsedDttm" -> query.orderBy( case "lastUsedDttm" ->
query.orderBy(
asc asc
? modelHyperParamEntity.lastUsedDttm.asc() ? modelHyperParamEntity.lastUsedDttm.asc()
: modelHyperParamEntity.lastUsedDttm.desc()); : modelHyperParamEntity.lastUsedDttm.desc());
@@ -190,7 +192,8 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
.from(modelHyperParamEntity) .from(modelHyperParamEntity)
.where( .where(
modelHyperParamEntity modelHyperParamEntity
.delYn.isFalse() .delYn
.isFalse()
.and(modelHyperParamEntity.modelType.eq(modelType))) .and(modelHyperParamEntity.modelType.eq(modelType)))
.fetch(); .fetch();
} }