feat/training_260202 #49
@@ -92,9 +92,8 @@ public class ModelTrainMngApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ApiResponseDto<String> createModelTrain(@Valid @RequestBody ModelTrainMngDto.AddReq req) {
|
public ApiResponseDto<UUID> createModelTrain(@Valid @RequestBody ModelTrainMngDto.AddReq req) {
|
||||||
modelTrainMngService.createModelTrain(req);
|
return ApiResponseDto.ok(modelTrainMngService.createModelTrain(req));
|
||||||
return ApiResponseDto.ok("ok");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "모델학습 config 정보 조회", description = "모델학습 config 정보 조회 API")
|
@Operation(summary = "모델학습 config 정보 조회", description = "모델학습 config 정보 조회 API")
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class ModelTrainMngService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public void createModelTrain(ModelTrainMngDto.AddReq req) {
|
public UUID createModelTrain(ModelTrainMngDto.AddReq req) {
|
||||||
HyperParam hyperParam = req.getHyperParam();
|
HyperParam hyperParam = req.getHyperParam();
|
||||||
HyperParamDto.Basic hyper = new HyperParamDto.Basic();
|
HyperParamDto.Basic hyper = new HyperParamDto.Basic();
|
||||||
|
|
||||||
@@ -81,7 +81,10 @@ public class ModelTrainMngService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 모델학습 테이블 저장
|
// 모델학습 테이블 저장
|
||||||
Long modelId = modelTrainMngCoreService.saveModel(req);
|
ModelTrainMngDto.Basic modelDto = modelTrainMngCoreService.saveModel(req);
|
||||||
|
|
||||||
|
Long modelId = modelDto.getId();
|
||||||
|
UUID modelUuid = modelDto.getUuid();
|
||||||
|
|
||||||
// 모델학습 데이터셋 저장
|
// 모델학습 데이터셋 저장
|
||||||
modelTrainMngCoreService.saveModelDataset(modelId, req);
|
modelTrainMngCoreService.saveModelDataset(modelId, req);
|
||||||
@@ -109,10 +112,7 @@ public class ModelTrainMngService {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 저장 다 끝난 뒤에 job enqueue
|
return modelUuid;
|
||||||
if (Boolean.TRUE.equals(req.getIsStart())) {
|
|
||||||
trainJobService.enqueue(modelId); // job 저장 + 이벤트 발행(실행은 AFTER_COMMIT)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class ModelTrainMngCoreService {
|
|||||||
* @param addReq
|
* @param addReq
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Long saveModel(ModelTrainMngDto.AddReq addReq) {
|
public ModelTrainMngDto.Basic saveModel(ModelTrainMngDto.AddReq addReq) {
|
||||||
ModelMasterEntity entity = new ModelMasterEntity();
|
ModelMasterEntity entity = new ModelMasterEntity();
|
||||||
ModelHyperParamEntity hyperParamEntity = new ModelHyperParamEntity();
|
ModelHyperParamEntity hyperParamEntity = new ModelHyperParamEntity();
|
||||||
|
|
||||||
@@ -117,7 +117,12 @@ public class ModelTrainMngCoreService {
|
|||||||
|
|
||||||
entity.setCreatedUid(userUtil.getId());
|
entity.setCreatedUid(userUtil.getId());
|
||||||
ModelMasterEntity resultEntity = modelMngRepository.save(entity);
|
ModelMasterEntity resultEntity = modelMngRepository.save(entity);
|
||||||
return resultEntity.getId();
|
|
||||||
|
ModelTrainMngDto.Basic result = new ModelTrainMngDto.Basic();
|
||||||
|
result.setId(resultEntity.getId());
|
||||||
|
result.setUuid(resultEntity.getUuid());
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user