모델학습 데이터 등록 수정
This commit is contained in:
@@ -57,6 +57,9 @@ public class HyperParamCoreService {
|
||||
.findHyperParamByUuid(uuid)
|
||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||
|
||||
if (entity.getHyperVer().equals("HPs_0001")) {
|
||||
throw new CustomApiException("UNPROCESSABLE_ENTITY_UPDATE", HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
applyHyperParam(entity, createReq);
|
||||
|
||||
// user
|
||||
@@ -120,7 +123,7 @@ public class HyperParamCoreService {
|
||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||
|
||||
if (entity.getHyperVer().equals("HPs_0001")) {
|
||||
throw new CustomApiException("CONFLICT", HttpStatus.CONFLICT, "HPs_0001 버전은 삭제할수 없습니다.");
|
||||
throw new CustomApiException("UNPROCESSABLE_ENTITY", HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
entity.setDelYn(true);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kamco.cd.training.postgres.core;
|
||||
|
||||
import com.kamco.cd.training.common.enums.HyperParamSelectType;
|
||||
import com.kamco.cd.training.common.enums.ModelType;
|
||||
import com.kamco.cd.training.common.enums.TrainStatusType;
|
||||
import com.kamco.cd.training.common.exception.BadRequestException;
|
||||
@@ -71,22 +72,37 @@ public class ModelTrainMngCoreService {
|
||||
*/
|
||||
public Long saveModel(ModelTrainMngDto.AddReq addReq) {
|
||||
ModelMasterEntity entity = new ModelMasterEntity();
|
||||
ModelHyperParamEntity hyperParamEntity =
|
||||
hyperParamRepository.findHyperParamByUuid(addReq.getHyperUuid()).orElse(null);
|
||||
ModelHyperParamEntity hyperParamEntity = new ModelHyperParamEntity();
|
||||
|
||||
entity.setModelNo(addReq.getModelNo());
|
||||
entity.setTrainType(addReq.getTrainType());
|
||||
// 최적화 파라미터는 HPs_0001 사용
|
||||
if (HyperParamSelectType.OPTIMIZED.getId().equals(addReq.getHyperParamType())) {
|
||||
hyperParamEntity = hyperParamRepository.findByHyperVer("HPs_0001").orElse(null);
|
||||
|
||||
if (hyperParamEntity != null) {
|
||||
entity.setHyperParamId(hyperParamEntity.getId());
|
||||
} else {
|
||||
hyperParamEntity =
|
||||
hyperParamRepository.findHyperParamByUuid(addReq.getHyperUuid()).orElse(null);
|
||||
}
|
||||
|
||||
if (hyperParamEntity == null || hyperParamEntity.getHyperVer() == null) {
|
||||
throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
String modelVer =
|
||||
String.join(
|
||||
".", addReq.getModelNo(), hyperParamEntity.getHyperVer(), entity.getUuid().toString());
|
||||
entity.setModelVer(modelVer);
|
||||
entity.setHyperParamId(hyperParamEntity.getId());
|
||||
entity.setModelNo(addReq.getModelNo());
|
||||
entity.setTrainType(addReq.getTrainType()); // 일반, 전이
|
||||
|
||||
if (addReq.getIsStart()) {
|
||||
entity.setModelStep((short) 1);
|
||||
entity.setStatusCd(TrainStatusType.IN_PROGRESS.getId());
|
||||
entity.setStrtDttm(ZonedDateTime.now());
|
||||
entity.setStep1StrtDttm(ZonedDateTime.now());
|
||||
entity.setStep1State(TrainStatusType.IN_PROGRESS.getId());
|
||||
} else {
|
||||
entity.setStatusCd(TrainStatusType.READY.getId());
|
||||
}
|
||||
|
||||
entity.setCreatedUid(userUtil.getId());
|
||||
|
||||
@@ -32,8 +32,8 @@ public class ModelMasterEntity {
|
||||
@Column(name = "model_no", length = 10)
|
||||
private String modelNo;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "model_ver", length = 50)
|
||||
@Size(max = 200)
|
||||
@Column(name = "model_ver", length = 200)
|
||||
private String modelVer;
|
||||
|
||||
@Column(name = "model_step")
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.kamco.cd.training.postgres.repository.hyperparam;
|
||||
|
||||
import com.kamco.cd.training.postgres.entity.ModelHyperParamEntity;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface HyperParamRepository
|
||||
extends JpaRepository<ModelHyperParamEntity, Long>, HyperParamRepositoryCustom {}
|
||||
extends JpaRepository<ModelHyperParamEntity, Long>, HyperParamRepositoryCustom {
|
||||
Optional<ModelHyperParamEntity> findByHyperVer(String hyperVer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user