추론 진행 현황 수정
This commit is contained in:
@@ -272,14 +272,14 @@ public class InferenceResultApiController {
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Page.class))),
|
||||
schema = @Schema(implementation = InferenceStatusDetailDto.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/status/{uuid}")
|
||||
public ApiResponseDto<InferenceStatusDetailDto> getInferenceStatus(
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "추론진행현왕 요청 정보",
|
||||
description = "추론 진행현황 정보",
|
||||
required = true)
|
||||
@PathVariable
|
||||
UUID uuid) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
@@ -23,7 +22,9 @@ import org.springframework.data.domain.Pageable;
|
||||
|
||||
public class InferenceResultDto {
|
||||
|
||||
/** 탐지 데이터 옵션 dto */
|
||||
/**
|
||||
* 탐지 데이터 옵션 dto
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MapSheetScope implements EnumType {
|
||||
@@ -52,7 +53,9 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
/** 분석대상 도엽 enum */
|
||||
/**
|
||||
* 분석대상 도엽 enum
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DetectOption implements EnumType {
|
||||
@@ -129,7 +132,9 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
/** 목록조회 dto */
|
||||
/**
|
||||
* 목록조회 dto
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@@ -141,11 +146,15 @@ public class InferenceResultDto {
|
||||
private String status;
|
||||
private String mapSheetCnt;
|
||||
private Long detectingCnt;
|
||||
@JsonFormatDttm private ZonedDateTime startTime;
|
||||
@JsonFormatDttm private ZonedDateTime endTime;
|
||||
@JsonFormatDttm private ZonedDateTime elapsedTime;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime startTime;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime endTime;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime elapsedTime;
|
||||
private Boolean applyYn;
|
||||
@JsonFormatDttm private ZonedDateTime applyDttm;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime applyDttm;
|
||||
|
||||
@JsonProperty("statusName")
|
||||
public String statusName() {
|
||||
@@ -153,7 +162,9 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
/** 목록조회 검색 조건 dto */
|
||||
/**
|
||||
* 목록조회 검색 조건 dto
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@@ -175,7 +186,9 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
/** 변화탐지 실행 정보 저장 요청 정보 */
|
||||
/**
|
||||
* 변화탐지 실행 정보 저장 요청 정보
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@@ -234,142 +247,151 @@ public class InferenceResultDto {
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "InferenceStatusDetailDto", description = "추론(변화탐지) 진행상태")
|
||||
public static class InferenceStatusDetailDto {
|
||||
|
||||
@Schema(description = "탐지대상 도엽수")
|
||||
private Long detectingCnt;
|
||||
@Schema(description = "모델1 분석 대기")
|
||||
private Integer m1PendingJobs;
|
||||
@Schema(description = "모델2 분석 대기")
|
||||
private Integer m2PendingJobs;
|
||||
@Schema(description = "모델3 분석 대기")
|
||||
private Integer m3PendingJobs;
|
||||
@Schema(description = "모델1 분석 완료")
|
||||
private Integer m1CompletedJobs;
|
||||
@Schema(description = "모델2 분석 완료")
|
||||
private Integer m2CompletedJobs;
|
||||
@Schema(description = "모델3 분석 완료")
|
||||
private Integer m3CompletedJobs;
|
||||
@Schema(description = "모델1 분석 실패")
|
||||
private Integer m1FailedJobs;
|
||||
@Schema(description = "모델2 분석 실패")
|
||||
private Integer m2FailedJobs;
|
||||
@Schema(description = "모델3 분석 실패")
|
||||
private Integer m3FailedJobs;
|
||||
@Schema(description = "모델1 사용시간 시작일시")
|
||||
@JsonFormatDttm
|
||||
ZonedDateTime m1ModelStartDttm;
|
||||
@Schema(description = "모델2 사용시간 시작일시")
|
||||
@JsonFormatDttm
|
||||
ZonedDateTime m2ModelStartDttm;
|
||||
@Schema(description = "모델3 사용시간 시작일시")
|
||||
@JsonFormatDttm
|
||||
ZonedDateTime m3ModelStartDttm;
|
||||
@Schema(description = "모델1 사용시간 종료일시")
|
||||
@JsonFormatDttm
|
||||
ZonedDateTime m1ModelEndDttm;
|
||||
@Schema(description = "모델2 사용시간 종료일시")
|
||||
@JsonFormatDttm
|
||||
ZonedDateTime m2ModelEndDttm;
|
||||
@Schema(description = "모델3 사용시간 종료일시")
|
||||
@JsonFormatDttm
|
||||
ZonedDateTime m3ModelEndDttm;
|
||||
@Schema(description = "변화탐지 제목")
|
||||
private String title;
|
||||
@Schema(description = "비교년도")
|
||||
private Integer compareYyyy;
|
||||
@Schema(description = "기준년도")
|
||||
private Integer targetYyyy;
|
||||
@Schema(description = "회차")
|
||||
private Integer stage;
|
||||
@Schema(description = "변화탐지 시작")
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime inferStartDttm;
|
||||
@Schema(description = "변화탐지 종료")
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime inferEndDttm;
|
||||
@Schema(description = "변화탐지 옵션")
|
||||
private String detectOption;
|
||||
@Schema(description = "분석도엽")
|
||||
private String mapSheetScope;
|
||||
@JsonFormatDttm private ZonedDateTime inferStartDttm;
|
||||
@JsonFormatDttm private ZonedDateTime inferEndDttm;
|
||||
private Long detectingCnt = 0L;
|
||||
private Long detectingEndCnt = 0L;
|
||||
|
||||
@JsonFormatDttm private ZonedDateTime m1ModelStartDttm;
|
||||
@JsonFormatDttm private ZonedDateTime m1ModelEndDttm;
|
||||
@JsonFormatDttm private ZonedDateTime m2ModelStartDttm;
|
||||
@JsonFormatDttm private ZonedDateTime m2ModelEndDttm;
|
||||
@JsonFormatDttm private ZonedDateTime m3ModelStartDttm;
|
||||
@JsonFormatDttm private ZonedDateTime m3ModelEndDttm;
|
||||
|
||||
private String model1Ver;
|
||||
private String model2Ver;
|
||||
private String model3Ver;
|
||||
private String usedServerName;
|
||||
private String model1VerStatus = "PROCCESING";
|
||||
private String model1VerStatusName = "진행중";
|
||||
private String model2VerStatus = "PROCCESING";
|
||||
private String model2VerStatusName = "진행중";
|
||||
private String model3VerStatus = "PROCCESING";
|
||||
private String model3VerStatusName = "진행중";
|
||||
@Schema(description = "모델1 버전")
|
||||
private String modelVer1;
|
||||
@Schema(description = "모델2 버전")
|
||||
private String modelVer2;
|
||||
@Schema(description = "모델3 버전")
|
||||
private String modelVer3;
|
||||
|
||||
public InferenceStatusDetailDto(
|
||||
Long detectingCnt,
|
||||
Integer m1PendingJobs,
|
||||
Integer m2PendingJobs,
|
||||
Integer m3PendingJobs,
|
||||
Integer m1CompletedJobs,
|
||||
Integer m2CompletedJobs,
|
||||
Integer m3CompletedJobs,
|
||||
Integer m1FailedJobs,
|
||||
Integer m2FailedJobs,
|
||||
Integer m3FailedJobs,
|
||||
ZonedDateTime m1ModelStartDttm,
|
||||
ZonedDateTime m2ModelStartDttm,
|
||||
ZonedDateTime m3ModelStartDttm,
|
||||
ZonedDateTime m1ModelEndDttm,
|
||||
ZonedDateTime m2ModelEndDttm,
|
||||
ZonedDateTime m3ModelEndDttm,
|
||||
String title,
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy,
|
||||
String detectOption,
|
||||
String mapSheetScope,
|
||||
Integer stage,
|
||||
ZonedDateTime inferStartDttm,
|
||||
ZonedDateTime inferEndDttm,
|
||||
Long detectingCnt,
|
||||
Long detectingEndCnt,
|
||||
ZonedDateTime m1ModelStartDttm,
|
||||
ZonedDateTime m1ModelEndDttm,
|
||||
ZonedDateTime m2ModelStartDttm,
|
||||
ZonedDateTime m2ModelEndDttm,
|
||||
ZonedDateTime m3ModelStartDttm,
|
||||
ZonedDateTime m3ModelEndDttm,
|
||||
String model1Ver,
|
||||
String model2Ver,
|
||||
String model3Ver) {
|
||||
String detectOption,
|
||||
String mapSheetScope,
|
||||
String modelVer1,
|
||||
String modelVer2,
|
||||
String modelVer3
|
||||
) {
|
||||
this.detectingCnt = detectingCnt;
|
||||
this.m1PendingJobs = m1PendingJobs;
|
||||
this.m2PendingJobs = m2PendingJobs;
|
||||
this.m3PendingJobs = m3PendingJobs;
|
||||
this.m1CompletedJobs = m1CompletedJobs;
|
||||
this.m2CompletedJobs = m2CompletedJobs;
|
||||
this.m3CompletedJobs = m3CompletedJobs;
|
||||
this.m1FailedJobs = m1FailedJobs;
|
||||
this.m2FailedJobs = m2FailedJobs;
|
||||
this.m3FailedJobs = m3FailedJobs;
|
||||
this.m1ModelStartDttm = m1ModelStartDttm;
|
||||
this.m2ModelStartDttm = m2ModelStartDttm;
|
||||
this.m3ModelStartDttm = m3ModelStartDttm;
|
||||
this.m1ModelEndDttm = m1ModelEndDttm;
|
||||
this.m2ModelEndDttm = m2ModelEndDttm;
|
||||
this.m3ModelEndDttm = m3ModelEndDttm;
|
||||
this.title = title;
|
||||
this.compareYyyy = compareYyyy;
|
||||
this.targetYyyy = targetYyyy;
|
||||
this.detectOption = detectOption;
|
||||
this.mapSheetScope = mapSheetScope;
|
||||
this.stage = stage;
|
||||
this.inferStartDttm = inferStartDttm;
|
||||
this.inferEndDttm = inferEndDttm;
|
||||
this.detectingCnt = detectingCnt;
|
||||
this.detectingEndCnt = detectingEndCnt;
|
||||
this.m1ModelStartDttm = m1ModelStartDttm;
|
||||
this.m1ModelEndDttm = m1ModelEndDttm;
|
||||
this.m2ModelStartDttm = m2ModelStartDttm;
|
||||
this.m2ModelEndDttm = m2ModelEndDttm;
|
||||
this.m3ModelStartDttm = m3ModelStartDttm;
|
||||
this.m3ModelEndDttm = m3ModelEndDttm;
|
||||
this.model1Ver = model1Ver;
|
||||
this.model2Ver = model2Ver;
|
||||
this.model3Ver = model3Ver;
|
||||
this.detectOption = detectOption;
|
||||
this.mapSheetScope = mapSheetScope;
|
||||
this.modelVer1 = modelVer1;
|
||||
this.modelVer2 = modelVer2;
|
||||
this.modelVer3 = modelVer3;
|
||||
}
|
||||
|
||||
if (this.detectingEndCnt == null) {
|
||||
this.detectingEndCnt = 0L;
|
||||
@JsonProperty("progress")
|
||||
private int getProgress() {
|
||||
long tiles = this.detectingCnt; // 도엽수
|
||||
int models = 3; // 모델 개수
|
||||
int completed = this.m1CompletedJobs + this.m2CompletedJobs + this.m3CompletedJobs + this.m1FailedJobs + this.m2FailedJobs + this.m3FailedJobs; // 완료수
|
||||
|
||||
long total = tiles * models; // 전체 작업량
|
||||
return (int) ((completed * 100L) / total);
|
||||
}
|
||||
|
||||
@JsonProperty("detectOptionName")
|
||||
private String getDetectOptionName() {
|
||||
return DetectOption.getDescByCode(this.detectOption);
|
||||
}
|
||||
|
||||
@JsonProperty("mapSheetScopeName")
|
||||
private String getMapSheetScope() {
|
||||
return MapSheetScope.getDescByCode(this.mapSheetScope);
|
||||
}
|
||||
}
|
||||
|
||||
public String getDetectOptionName() {
|
||||
if (this.detectOption.equals("EXCL")) {
|
||||
return "추론제외";
|
||||
}
|
||||
return "이전 년도 도엽 사용";
|
||||
}
|
||||
|
||||
public String getMapSheetScopeName() {
|
||||
if (this.mapSheetScope.equals("ALL")) {
|
||||
return "전체";
|
||||
}
|
||||
return "부분";
|
||||
}
|
||||
|
||||
public double getDetectingRate() {
|
||||
if (this.detectingCnt == null || this.detectingCnt == 0L) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (this.detectingEndCnt == null) {
|
||||
this.detectingEndCnt = 0L;
|
||||
}
|
||||
|
||||
return (double) (this.detectingEndCnt / this.detectingCnt) * 100.0;
|
||||
}
|
||||
|
||||
public String getM1Duration() {
|
||||
if (this.m1ModelStartDttm == null || this.m1ModelEndDttm == null) {
|
||||
return "00:00:00";
|
||||
}
|
||||
Duration duration = Duration.between(m1ModelStartDttm, m1ModelEndDttm);
|
||||
long hours = duration.toHours();
|
||||
long minutes = duration.toMinutesPart();
|
||||
long seconds = duration.toSecondsPart();
|
||||
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
public String getM2Duration() {
|
||||
if (this.m2ModelStartDttm == null || this.m2ModelEndDttm == null) {
|
||||
return "00:00:00";
|
||||
}
|
||||
Duration duration = Duration.between(this.m2ModelStartDttm, this.m2ModelEndDttm);
|
||||
long hours = duration.toHours();
|
||||
long minutes = duration.toMinutesPart();
|
||||
long seconds = duration.toSecondsPart();
|
||||
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
public String getM3Duration() {
|
||||
if (this.m3ModelStartDttm == null || this.m3ModelEndDttm == null) {
|
||||
return "00:00:00";
|
||||
}
|
||||
Duration duration = Duration.between(this.m3ModelStartDttm, this.m3ModelEndDttm);
|
||||
long hours = duration.toHours();
|
||||
long minutes = duration.toMinutesPart();
|
||||
long seconds = duration.toSecondsPart();
|
||||
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -378,9 +400,12 @@ public class InferenceResultDto {
|
||||
public static class InferenceServerStatusDto {
|
||||
|
||||
private String serverName;
|
||||
@JsonIgnore private float cpu_user;
|
||||
@JsonIgnore private float cpu_system;
|
||||
@JsonIgnore private float memused;
|
||||
@JsonIgnore
|
||||
private float cpu_user;
|
||||
@JsonIgnore
|
||||
private float cpu_system;
|
||||
@JsonIgnore
|
||||
private float memused;
|
||||
private Long kbmemused;
|
||||
private float gpuUtil;
|
||||
|
||||
@@ -453,6 +478,15 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class InferenceStatusDetailDto2 {
|
||||
|
||||
InferenceServerStatusDto serverStatus;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
|
||||
@@ -305,7 +305,8 @@ public class InferenceResultService {
|
||||
// 4) 응답 파싱
|
||||
try {
|
||||
List<Map<String, Object>> list =
|
||||
objectMapper.readValue(result.body(), new TypeReference<>() {});
|
||||
objectMapper.readValue(result.body(), new TypeReference<>() {
|
||||
});
|
||||
|
||||
if (list.isEmpty()) {
|
||||
throw new IllegalStateException("Inference response is empty");
|
||||
@@ -463,23 +464,14 @@ public class InferenceResultService {
|
||||
return inferenceResultCoreService.getInferenceServerStatusList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 추론 진행 현황 상세
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
||||
|
||||
List<InferenceServerStatusDto> servers =
|
||||
inferenceResultCoreService.getInferenceServerStatusList();
|
||||
|
||||
String serverNames = "";
|
||||
for (InferenceServerStatusDto server : servers) {
|
||||
if (serverNames.equals("")) {
|
||||
serverNames = server.getServerName();
|
||||
} else {
|
||||
serverNames = serverNames + "," + server.getServerName();
|
||||
}
|
||||
}
|
||||
|
||||
InferenceStatusDetailDto dto = inferenceResultCoreService.getInferenceStatus(uuid);
|
||||
dto.setUsedServerName(serverNames);
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
@@ -268,8 +268,7 @@ public class InferenceResultCoreService {
|
||||
|
||||
private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) {
|
||||
switch (request.getType()) {
|
||||
case "M1" ->
|
||||
applyModelFields(
|
||||
case "M1" -> applyModelFields(
|
||||
request,
|
||||
entity::setM1ModelBatchId,
|
||||
entity::setM1ModelStartDttm,
|
||||
@@ -278,8 +277,7 @@ public class InferenceResultCoreService {
|
||||
entity::setM1RunningJobs,
|
||||
entity::setM1CompletedJobs,
|
||||
entity::setM1FailedJobs);
|
||||
case "M2" ->
|
||||
applyModelFields(
|
||||
case "M2" -> applyModelFields(
|
||||
request,
|
||||
entity::setM2ModelBatchId,
|
||||
entity::setM2ModelStartDttm,
|
||||
@@ -288,8 +286,7 @@ public class InferenceResultCoreService {
|
||||
entity::setM2RunningJobs,
|
||||
entity::setM2CompletedJobs,
|
||||
entity::setM2FailedJobs);
|
||||
case "M3" ->
|
||||
applyModelFields(
|
||||
case "M3" -> applyModelFields(
|
||||
request,
|
||||
entity::setM3ModelBatchId,
|
||||
entity::setM3ModelStartDttm,
|
||||
@@ -326,6 +323,11 @@ public class InferenceResultCoreService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버 정보 조회
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
||||
return mapSheetLearnRepository.getInferenceServerStatusList();
|
||||
}
|
||||
|
||||
@@ -150,6 +150,12 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
.fetchOne());
|
||||
}
|
||||
|
||||
/**
|
||||
* 추론 실행 진행 현황
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
||||
|
||||
@@ -164,21 +170,30 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceStatusDetailDto.class,
|
||||
mapSheetLearnEntity.detectingCnt,
|
||||
mapSheetLearnEntity.m1PendingJobs,
|
||||
mapSheetLearnEntity.m2PendingJobs,
|
||||
mapSheetLearnEntity.m3PendingJobs,
|
||||
mapSheetLearnEntity.m1CompletedJobs,
|
||||
mapSheetLearnEntity.m2CompletedJobs,
|
||||
mapSheetLearnEntity.m3CompletedJobs,
|
||||
mapSheetLearnEntity.m1FailedJobs,
|
||||
mapSheetLearnEntity.m2FailedJobs,
|
||||
mapSheetLearnEntity.m3FailedJobs,
|
||||
mapSheetLearnEntity.m1ModelStartDttm,
|
||||
mapSheetLearnEntity.m2ModelStartDttm,
|
||||
mapSheetLearnEntity.m3ModelStartDttm,
|
||||
mapSheetLearnEntity.m1ModelEndDttm,
|
||||
mapSheetLearnEntity.m2ModelEndDttm,
|
||||
mapSheetLearnEntity.m3ModelEndDttm,
|
||||
mapSheetLearnEntity.title,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.detectOption,
|
||||
mapSheetLearnEntity.mapSheetScope,
|
||||
mapSheetLearnEntity.stage,
|
||||
mapSheetLearnEntity.inferStartDttm,
|
||||
mapSheetLearnEntity.inferEndDttm,
|
||||
mapSheetLearnEntity.detectingCnt,
|
||||
mapSheetLearnEntity.detectEndCnt,
|
||||
mapSheetLearnEntity.m1ModelStartDttm,
|
||||
mapSheetLearnEntity.m1ModelEndDttm,
|
||||
mapSheetLearnEntity.m2ModelStartDttm,
|
||||
mapSheetLearnEntity.m2ModelEndDttm,
|
||||
mapSheetLearnEntity.m3ModelStartDttm,
|
||||
mapSheetLearnEntity.m3ModelEndDttm,
|
||||
mapSheetLearnEntity.detectOption,
|
||||
mapSheetLearnEntity.mapSheetScope,
|
||||
m1Model.modelVer.as("model1Ver"),
|
||||
m2Model.modelVer.as("model2Ver"),
|
||||
m3Model.modelVer.as("model3Ver")))
|
||||
|
||||
Reference in New Issue
Block a user