Merge pull request '[KC-99] 추론 진행여부 api 추가, spotless 적용' (#220) from feat/infer_dev_260107 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/220
This commit is contained in:
@@ -73,6 +73,28 @@ public class InferenceResultApiController {
|
|||||||
return ApiResponseDto.ok(analResList);
|
return ApiResponseDto.ok(analResList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "추론 진행 여부 확인", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "검색 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema =
|
||||||
|
@Schema(
|
||||||
|
description = "진행 여부 (Y: 진행중, N: 없음)",
|
||||||
|
type = "string",
|
||||||
|
example = "N"))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping("/processing-yn")
|
||||||
|
public ApiResponseDto<String> getProcessing() {
|
||||||
|
return ApiResponseDto.ok(inferenceResultService.getProcessing());
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "년도 목록 조회", description = "어드민 홈 > 추론관리 > 추론목록 > 변화탐지 실행 정보 입력 > 년도 목록 조회")
|
@Operation(summary = "년도 목록 조회", description = "어드민 홈 > 추론관리 > 추론목록 > 변화탐지 실행 정보 입력 > 년도 목록 조회")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
|
|||||||
@@ -74,6 +74,15 @@ public class InferenceResultService {
|
|||||||
return inferenceResultCoreService.getInferenceResultList(req);
|
return inferenceResultCoreService.getInferenceResultList(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 진행중인지 확인
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getProcessing() {
|
||||||
|
return inferenceResultCoreService.getProcessing();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 변화탐지 실행 정보 생성
|
* 변화탐지 실행 정보 생성
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -341,4 +341,13 @@ public class InferenceResultCoreService {
|
|||||||
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
||||||
return mapSheetLearnRepository.getInferenceStatus(uuid);
|
return mapSheetLearnRepository.getInferenceStatus(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 진행중인지 확인
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getProcessing() {
|
||||||
|
return mapSheetLearnRepository.getProcessing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,7 @@ public interface MapSheetLearnRepositoryCustom {
|
|||||||
|
|
||||||
InferenceProgressDto getInferenceAiResultById(Long id, UUID modelUuid);
|
InferenceProgressDto getInferenceAiResultById(Long id, UUID modelUuid);
|
||||||
|
|
||||||
public InferenceStatusDetailDto getInferenceStatus(UUID uuid);
|
InferenceStatusDetailDto getInferenceStatus(UUID uuid);
|
||||||
|
|
||||||
|
String getProcessing();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,4 +225,22 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
.fetchOne();
|
.fetchOne();
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 진행중인지 조회
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getProcessing() {
|
||||||
|
Long processing =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetLearnEntity.count())
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.status.eq("IN_PROGRESS"))
|
||||||
|
.fetchOne();
|
||||||
|
if (Long.valueOf(0L).equals(processing)) {
|
||||||
|
return "N";
|
||||||
|
}
|
||||||
|
return "Y";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,14 @@ public class MapSheetInferenceJobService {
|
|||||||
String json = result.body();
|
String json = result.body();
|
||||||
JobStatusDto dto = objectMapper.readValue(json, JobStatusDto.class);
|
JobStatusDto dto = objectMapper.readValue(json, JobStatusDto.class);
|
||||||
|
|
||||||
if ("COMPLETED".equals(dto.getStatus())) {
|
int totalJobs = dto.getTotalJobs();
|
||||||
|
int completedJobs = dto.getCompletedJobs();
|
||||||
|
int failedJobs = dto.getFailedJobs();
|
||||||
|
|
||||||
|
// 성공, 실패 값 더해서 total 과 같으면 완료
|
||||||
|
String inferStatus = this.setStatus(totalJobs, completedJobs, failedJobs);
|
||||||
|
|
||||||
|
if ("COMPLETED".equals(inferStatus)) {
|
||||||
String type = batchSheet.getRunningModelType();
|
String type = batchSheet.getRunningModelType();
|
||||||
|
|
||||||
if (type.equals("M1")) {
|
if (type.equals("M1")) {
|
||||||
@@ -122,18 +129,11 @@ public class MapSheetInferenceJobService {
|
|||||||
// 종료시간
|
// 종료시간
|
||||||
this.updateProcessingEndTimeByModel(batchSheet.getUuid(), ZonedDateTime.now(), "M3");
|
this.updateProcessingEndTimeByModel(batchSheet.getUuid(), ZonedDateTime.now(), "M3");
|
||||||
}
|
}
|
||||||
} else if ("COMPLETED_WITH_FAILURES".equals(dto.getStatus())) {
|
|
||||||
SaveInferenceAiDto saveInferenceAiDto = new SaveInferenceAiDto();
|
|
||||||
saveInferenceAiDto.setUuid(batchSheet.getUuid());
|
|
||||||
saveInferenceAiDto.setStatus(Status.END.getId());
|
|
||||||
saveInferenceAiDto.setInferEndDttm(ZonedDateTime.now());
|
|
||||||
saveInferenceAiDto.setType(batchSheet.getRunningModelType());
|
|
||||||
inferenceResultCoreService.update(saveInferenceAiDto);
|
|
||||||
} else {
|
} else {
|
||||||
SaveInferenceAiDto saveInferenceAiDto = new SaveInferenceAiDto();
|
SaveInferenceAiDto saveInferenceAiDto = new SaveInferenceAiDto();
|
||||||
saveInferenceAiDto.setUuid(batchSheet.getUuid());
|
saveInferenceAiDto.setUuid(batchSheet.getUuid());
|
||||||
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
|
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
|
||||||
saveInferenceAiDto.setDetectEndCnt(dto.getCompletedJobs().longValue());
|
saveInferenceAiDto.setDetectEndCnt((long) (completedJobs + failedJobs));
|
||||||
saveInferenceAiDto.setType(batchSheet.getRunningModelType());
|
saveInferenceAiDto.setType(batchSheet.getRunningModelType());
|
||||||
inferenceResultCoreService.update(saveInferenceAiDto);
|
inferenceResultCoreService.update(saveInferenceAiDto);
|
||||||
}
|
}
|
||||||
@@ -236,4 +236,11 @@ public class MapSheetInferenceJobService {
|
|||||||
saveInferenceAiDto.setType(type);
|
saveInferenceAiDto.setType(type);
|
||||||
inferenceResultCoreService.update(saveInferenceAiDto);
|
inferenceResultCoreService.update(saveInferenceAiDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String setStatus(int totalJobs, int completedJobs, int failedJobs) {
|
||||||
|
if (totalJobs <= (completedJobs + failedJobs)) {
|
||||||
|
return "COMPLETED";
|
||||||
|
}
|
||||||
|
return "PROCESSING";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user