Merge pull request '모델학습 1단계 실행중인 것이 있는지 count API' (#54) from feat/training_260202 into develop
Reviewed-on: #54
This commit was merged in pull request #54.
This commit is contained in:
@@ -149,4 +149,22 @@ public class ModelTrainMngApiController {
|
|||||||
req.setDataType(selectType);
|
req.setDataType(selectType);
|
||||||
return ApiResponseDto.ok(modelTrainMngService.getDatasetSelectList(req));
|
return ApiResponseDto.ok(modelTrainMngService.getDatasetSelectList(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "모델학습 1단계 실행중인 것이 있는지 count", description = "모델학습 1단계 실행중인 것이 있는지 count")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "검색 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Long.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping("/ing-training-cnt")
|
||||||
|
public ApiResponseDto<Long> findModelStep1InProgressCnt() {
|
||||||
|
return ApiResponseDto.ok(modelTrainMngService.findModelStep1InProgressCnt());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,4 +136,8 @@ public class ModelTrainMngService {
|
|||||||
return modelTrainMngCoreService.getDatasetSelectG2G3List(req);
|
return modelTrainMngCoreService.getDatasetSelectG2G3List(req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long findModelStep1InProgressCnt() {
|
||||||
|
return modelTrainMngCoreService.findModelStep1InProgressCnt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -502,4 +502,8 @@ public class ModelTrainMngCoreService {
|
|||||||
public List<String> findDatasetUid(List<Long> datasetIds) {
|
public List<String> findDatasetUid(List<Long> datasetIds) {
|
||||||
return datasetRepository.findDatasetUid(datasetIds);
|
return datasetRepository.findDatasetUid(datasetIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long findModelStep1InProgressCnt() {
|
||||||
|
return modelMngRepository.findModelStep1InProgressCnt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ public interface ModelMngRepositoryCustom {
|
|||||||
Optional<ModelMasterEntity> findFirstByStatusCdAndDelYn(String statusCd, Boolean delYn);
|
Optional<ModelMasterEntity> findFirstByStatusCdAndDelYn(String statusCd, Boolean delYn);
|
||||||
|
|
||||||
TrainRunRequest findTrainRunRequest(Long modelId);
|
TrainRunRequest findTrainRunRequest(Long modelId);
|
||||||
|
|
||||||
|
Long findModelStep1InProgressCnt();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import static com.kamco.cd.training.postgres.entity.QModelConfigEntity.modelConf
|
|||||||
import static com.kamco.cd.training.postgres.entity.QModelHyperParamEntity.modelHyperParamEntity;
|
import static com.kamco.cd.training.postgres.entity.QModelHyperParamEntity.modelHyperParamEntity;
|
||||||
import static com.kamco.cd.training.postgres.entity.QModelMasterEntity.modelMasterEntity;
|
import static com.kamco.cd.training.postgres.entity.QModelMasterEntity.modelMasterEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.training.common.enums.TrainStatusType;
|
||||||
import com.kamco.cd.training.model.dto.ModelTrainMngDto;
|
import com.kamco.cd.training.model.dto.ModelTrainMngDto;
|
||||||
import com.kamco.cd.training.postgres.entity.ModelMasterEntity;
|
import com.kamco.cd.training.postgres.entity.ModelMasterEntity;
|
||||||
import com.kamco.cd.training.train.dto.TrainRunRequest;
|
import com.kamco.cd.training.train.dto.TrainRunRequest;
|
||||||
@@ -147,4 +148,13 @@ public class ModelMngRepositoryImpl implements ModelMngRepositoryCustom {
|
|||||||
.where(modelMasterEntity.id.eq(modelId))
|
.where(modelMasterEntity.id.eq(modelId))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findModelStep1InProgressCnt() {
|
||||||
|
return queryFactory
|
||||||
|
.select(modelMasterEntity.id.count())
|
||||||
|
.from(modelMasterEntity)
|
||||||
|
.where(modelMasterEntity.step1State.eq(TrainStatusType.IN_PROGRESS.getId()))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ public class ModelTrainMetricsJobService {
|
|||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
|
|
||||||
|
// 학습 결과가 저장될 호스트 디렉토리
|
||||||
|
@Value("${train.docker.responseDir}")
|
||||||
|
private String responseDir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 실행중인 profile
|
* 실행중인 profile
|
||||||
*
|
*
|
||||||
@@ -51,7 +55,7 @@ public class ModelTrainMetricsJobService {
|
|||||||
|
|
||||||
for (ResponsePathDto modelInfo : modelIds) {
|
for (ResponsePathDto modelInfo : modelIds) {
|
||||||
|
|
||||||
String trainPath = modelInfo.getResponsePath() + "/metrics/train.csv";
|
String trainPath = responseDir + "{uuid}/metrics/train.csv"; // TODO
|
||||||
try (BufferedReader reader =
|
try (BufferedReader reader =
|
||||||
Files.newBufferedReader(Paths.get(trainPath), StandardCharsets.UTF_8); ) {
|
Files.newBufferedReader(Paths.get(trainPath), StandardCharsets.UTF_8); ) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user