데이터셋 등록 추가
This commit is contained in:
@@ -0,0 +1,261 @@
|
||||
package com.kamco.cd.training.model;
|
||||
|
||||
import com.kamco.cd.training.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.training.model.dto.ModelTrainMngDto;
|
||||
import com.kamco.cd.training.model.dto.ModelTrainMngDto.Basic;
|
||||
import com.kamco.cd.training.model.service.ModelTrainMngService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "모델학습 관리", description = "어드민 홈 > 모델학습관리 > 모델관리 > 목록")
|
||||
@RequestMapping("/api/models")
|
||||
public class ModelTrainMngApiController {
|
||||
private final ModelTrainMngService modelTrainMngService;
|
||||
|
||||
@Operation(summary = "모델학습 목록 조회", description = "모델학습 목록 조회 API")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "검색 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Page.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/list")
|
||||
public ApiResponseDto<Page<Basic>> findByModelList(
|
||||
@Parameter(
|
||||
description = "상태코드",
|
||||
example = "IN_PROGRESS",
|
||||
schema = @Schema(allowableValues = {"", "IN_PROGRESS", "COMPLETED"}))
|
||||
@RequestParam(required = false)
|
||||
String status,
|
||||
@Parameter(description = "페이지 번호") @RequestParam(defaultValue = "0") int page,
|
||||
@Parameter(description = "페이지 크기") @RequestParam(defaultValue = "20") int size) {
|
||||
ModelTrainMngDto.SearchReq searchReq = new ModelTrainMngDto.SearchReq(status, page, size);
|
||||
return ApiResponseDto.ok(modelTrainMngService.getModelList(searchReq));
|
||||
}
|
||||
|
||||
@Operation(summary = "학습 모델 삭제", description = "학습 모델 삭제 API")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "삭제 성공", content = @Content),
|
||||
@ApiResponse(responseCode = "409", description = "HPs_0001 삭제 불가", content = @Content)
|
||||
})
|
||||
@DeleteMapping("/{uuid}")
|
||||
public ApiResponseDto<Void> deleteModelTrain(
|
||||
@Parameter(description = "학습 모델 uuid", example = "f2b02229-90f2-45f5-92ea-c56cf1c29f79")
|
||||
@PathVariable
|
||||
UUID uuid) {
|
||||
modelTrainMngService.deleteModelTrain(uuid);
|
||||
return ApiResponseDto.ok(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "학습 모델 등록", description = "학습 모델 등록 API")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "등록 성공", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping
|
||||
public ApiResponseDto<String> createModelTrain(@RequestBody ModelTrainMngDto.AddReq req) {
|
||||
modelTrainMngService.createModelTrain(req);
|
||||
return ApiResponseDto.ok("ok");
|
||||
}
|
||||
|
||||
//
|
||||
// @Operation(summary = "학습 모델 상세 조회", description = "학습 모델의 상세 정보를 UUID로 조회합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
// responseCode = "200",
|
||||
// description = "조회 성공",
|
||||
// content =
|
||||
// @Content(
|
||||
// mediaType = "application/json",
|
||||
// schema = @Schema(implementation = ModelMngDto.Detail.class))),
|
||||
// @ApiResponse(responseCode = "404", description = "모델을 찾을 수 없음", content = @Content),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @GetMapping("/{uuid}")
|
||||
// public ApiResponseDto<ModelMngDto.Detail> getModelDetail(
|
||||
// @Parameter(description = "모델 UUID", example = "b7e99739-6736-45f9-a224-8161ecddf287")
|
||||
// @PathVariable
|
||||
// String uuid) {
|
||||
// return ApiResponseDto.ok(modelTrainMngService.getModelDetailByUuid(uuid));
|
||||
// }
|
||||
//
|
||||
// // ==================== 학습 모델학습관리 API (5종) ====================
|
||||
//
|
||||
// @Operation(summary = "학습 모델 통합 조회", description = "학습 관리 화면에서 학습 이력 리스트와 현재 상태를 조회합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
// responseCode = "200",
|
||||
// description = "조회 성공",
|
||||
// content =
|
||||
// @Content(
|
||||
// mediaType = "application/json",
|
||||
// schema = @Schema(implementation = List.class))),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @GetMapping("/train")
|
||||
// public ApiResponseDto<List<ModelMngDto.TrainListRes>> getTrainModelList() {
|
||||
// return ApiResponseDto.ok(modelTrainService.getTrainModelList());
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "학습 설정 통합 조회", description = "학습 실행 팝업 구성에 필요한 모든 데이터를 한 번에 반환합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
// responseCode = "200",
|
||||
// description = "조회 성공",
|
||||
// content =
|
||||
// @Content(
|
||||
// mediaType = "application/json",
|
||||
// schema = @Schema(implementation = ModelMngDto.FormConfigRes.class))),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @GetMapping("/train/form-config")
|
||||
// public ApiResponseDto<ModelMngDto.FormConfigRes> getFormConfig() {
|
||||
// return ApiResponseDto.ok(modelTrainService.getFormConfig());
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "학습 시작", description = "모든 설정(Step 1~3)을 마치고 최종적으로 학습 프로세스를 시작합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
// responseCode = "200",
|
||||
// description = "학습 시작 성공",
|
||||
// content =
|
||||
// @Content(
|
||||
// mediaType = "application/json",
|
||||
// schema = @Schema(implementation = ModelMngDto.TrainStartRes.class))),
|
||||
// @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @PostMapping("/train")
|
||||
// public ApiResponseDto<ModelMngDto.TrainStartRes> startTraining(
|
||||
// @Valid @RequestBody ModelMngDto.TrainStartReq trainReq) {
|
||||
// return ApiResponseDto.ok(modelTrainService.startTraining(trainReq));
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "학습 모델 삭제", description = "목록에서 특정 학습 모델을 삭제합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(responseCode = "200", description = "삭제 성공", content = @Content),
|
||||
// @ApiResponse(responseCode = "400", description = "진행 중인 모델은 삭제 불가", content = @Content),
|
||||
// @ApiResponse(responseCode = "404", description = "모델을 찾을 수 없음", content = @Content),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @DeleteMapping("/train/{uuid}")
|
||||
// public ApiResponseDto<Void> deleteTrainModel(
|
||||
// @Parameter(description = "모델 UUID") @PathVariable String uuid) {
|
||||
// modelTrainService.deleteTrainModel(uuid);
|
||||
// return ApiResponseDto.ok(null);
|
||||
// }
|
||||
//
|
||||
// // ==================== Resume Training (학습 재시작) ====================
|
||||
//
|
||||
// @Operation(summary = "학습 재시작 정보 조회", description = "중단된 학습의 재시작 가능 여부와 Checkpoint 정보를 조회합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
// responseCode = "200",
|
||||
// description = "조회 성공",
|
||||
// content =
|
||||
// @Content(
|
||||
// mediaType = "application/json",
|
||||
// schema = @Schema(implementation = ModelMngDto.ResumeInfo.class))),
|
||||
// @ApiResponse(responseCode = "404", description = "모델을 찾을 수 없음", content = @Content),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @GetMapping("/train/{uuid}/resume-info")
|
||||
// public ApiResponseDto<ModelMngDto.ResumeInfo> getResumeInfo(
|
||||
// @Parameter(description = "모델 UUID") @PathVariable String uuid) {
|
||||
// return ApiResponseDto.ok(modelTrainService.getResumeInfo(uuid));
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "학습 재시작", description = "중단된 지점(Checkpoint)부터 학습을 재개합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
// responseCode = "200",
|
||||
// description = "재시작 성공",
|
||||
// content =
|
||||
// @Content(
|
||||
// mediaType = "application/json",
|
||||
// schema = @Schema(implementation = ModelMngDto.ResumeResponse.class))),
|
||||
// @ApiResponse(responseCode = "400", description = "재시작 불가능한 상태", content = @Content),
|
||||
// @ApiResponse(responseCode = "404", description = "모델을 찾을 수 없음", content = @Content),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @PostMapping("/train/{uuid}/resume")
|
||||
// public ApiResponseDto<ModelMngDto.ResumeResponse> resumeTraining(
|
||||
// @Parameter(description = "모델 UUID") @PathVariable String uuid,
|
||||
// @Valid @RequestBody ModelMngDto.ResumeRequest resumeReq) {
|
||||
// return ApiResponseDto.ok(modelTrainService.resumeTraining(uuid, resumeReq));
|
||||
// }
|
||||
//
|
||||
// // ==================== Best Epoch Setting (Best Epoch 설정) ====================
|
||||
//
|
||||
// @Operation(summary = "Best Epoch 설정", description = "사용자가 직접 Best Epoch를 선택하여 설정합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
// responseCode = "200",
|
||||
// description = "설정 성공",
|
||||
// content =
|
||||
// @Content(
|
||||
// mediaType = "application/json",
|
||||
// schema = @Schema(implementation = ModelMngDto.BestEpochResponse.class))),
|
||||
// @ApiResponse(responseCode = "404", description = "모델을 찾을 수 없음", content = @Content),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @PostMapping("/train/{uuid}/best-epoch")
|
||||
// public ApiResponseDto<ModelMngDto.BestEpochResponse> setBestEpoch(
|
||||
// @Parameter(description = "모델 UUID") @PathVariable String uuid,
|
||||
// @Valid @RequestBody ModelMngDto.BestEpochRequest bestEpochReq) {
|
||||
// return ApiResponseDto.ok(modelTrainService.setBestEpoch(uuid, bestEpochReq));
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "Epoch별 성능 지표 조회", description = "학습된 모델의 Epoch별 성능 지표를 조회합니다")
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
// responseCode = "200",
|
||||
// description = "조회 성공",
|
||||
// content =
|
||||
// @Content(
|
||||
// mediaType = "application/json",
|
||||
// schema = @Schema(implementation = List.class))),
|
||||
// @ApiResponse(responseCode = "404", description = "모델을 찾을 수 없음", content = @Content),
|
||||
// @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
// })
|
||||
// @GetMapping("/train/{uuid}/epoch-metrics")
|
||||
// public ApiResponseDto<List<ModelMngDto.EpochMetric>> getEpochMetrics(
|
||||
// @Parameter(description = "모델 UUID") @PathVariable String uuid) {
|
||||
// return ApiResponseDto.ok(modelTrainService.getEpochMetrics(uuid));
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user