모델관리 학습 조회 수정
This commit is contained in:
@@ -3,10 +3,12 @@ package com.kamco.cd.training.postgres.entity;
|
||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.PrePersist;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
@@ -16,6 +18,8 @@ import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -28,17 +32,14 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "model_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "uuid", columnDefinition = "uuid", nullable = false, updatable = false)
|
||||
private UUID uuid;
|
||||
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "model_ver", nullable = false, length = 50)
|
||||
private String modelVer;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "hyper_ver", length = 50)
|
||||
private String hyperVer;
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "hyper_ver")
|
||||
private ModelHyperParamEntity hyperVer;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "epoch_ver", length = 50)
|
||||
@@ -48,10 +49,6 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "process_step", length = 50)
|
||||
private String processStep;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "status_cd", length = 20)
|
||||
private String statusCd;
|
||||
|
||||
@Column(name = "train_start_dttm")
|
||||
private ZonedDateTime trainStartDttm;
|
||||
|
||||
@@ -68,19 +65,18 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "step1_end_dttm")
|
||||
private ZonedDateTime step1EndDttm;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "step1_duration", length = 50)
|
||||
private String step1Duration;
|
||||
private ZonedDateTime step1Duration;
|
||||
|
||||
@Column(name = "step2_end_dttm")
|
||||
private ZonedDateTime step2EndDttm;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "step2_duration", length = 50)
|
||||
private String step2Duration;
|
||||
private ZonedDateTime step2Duration;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "del_yn")
|
||||
@Column(name = "del_yn", nullable = false)
|
||||
private Boolean delYn = false;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
@@ -113,19 +109,6 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "error_msg", length = Integer.MAX_VALUE)
|
||||
private String errorMsg;
|
||||
|
||||
// ==================== Resume Training (학습 재시작) ====================
|
||||
|
||||
@Column(name = "last_checkpoint_epoch")
|
||||
private Integer lastCheckpointEpoch;
|
||||
|
||||
@Size(max = 500)
|
||||
@Column(name = "checkpoint_path", length = 500)
|
||||
private String checkpointPath;
|
||||
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "can_resume")
|
||||
private Boolean canResume = false;
|
||||
|
||||
@Column(name = "step2_start_dttm")
|
||||
private Instant step2StartDttm;
|
||||
|
||||
@@ -136,35 +119,60 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "memo", length = Integer.MAX_VALUE)
|
||||
private String memo;
|
||||
|
||||
@Column(name = "base_model_uid")
|
||||
private Integer baseModelUid;
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@OnDelete(action = OnDeleteAction.SET_NULL)
|
||||
@JoinColumn(name = "base_model_uid")
|
||||
private ModelTrainMasterEntity baseModelUid;
|
||||
|
||||
@Size(max = 1000)
|
||||
@Column(name = "pretrained_model_path", length = 1000)
|
||||
private String pretrainedModelPath;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
if (this.uuid == null) {
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
}
|
||||
@Column(name = "last_checkpoint_epoch")
|
||||
private Integer lastCheckpointEpoch;
|
||||
|
||||
@Size(max = 500)
|
||||
@ColumnDefault("NULL")
|
||||
@Column(name = "checkpoint_path", length = 500)
|
||||
private String checkpointPath;
|
||||
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "can_resume")
|
||||
private Boolean canResume;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("uuid_generate_v4()")
|
||||
@Column(name = "uuid", nullable = false)
|
||||
private UUID uuid;
|
||||
|
||||
@Size(max = 10)
|
||||
@Column(name = "step1_status", length = 10)
|
||||
private String step1Status;
|
||||
|
||||
@Size(max = 10)
|
||||
@Column(name = "step2_status", length = 10)
|
||||
private String step2Status;
|
||||
|
||||
@Size(max = 10)
|
||||
@Column(name = "transfer_status", length = 10)
|
||||
private String transferStatus;
|
||||
|
||||
@Size(max = 10)
|
||||
@Column(name = "status_cd", length = 10)
|
||||
private String statusCd;
|
||||
|
||||
public ModelMngDto.Basic toDto() {
|
||||
ModelMngDto.Basic dto = new ModelMngDto.Basic();
|
||||
dto.setId(this.id);
|
||||
dto.setModelNm(this.modelVer);
|
||||
dto.setStartDttm(this.trainStartDttm);
|
||||
dto.setTrainingEndDttm(this.step1EndDttm);
|
||||
dto.setTestEndDttm(this.step2EndDttm);
|
||||
dto.setDurationDttm(this.step2Duration);
|
||||
dto.setProcessStage(this.processStep);
|
||||
dto.setStatusCd(this.statusCd);
|
||||
return dto;
|
||||
}
|
||||
|
||||
/** UUID 필드가 제대로 설정되었는지 확인 (디버그용) */
|
||||
public String getUuidString() {
|
||||
return this.uuid != null ? this.uuid.toString() : null;
|
||||
return new ModelMngDto.Basic(
|
||||
this.id,
|
||||
this.uuid,
|
||||
this.modelVer,
|
||||
this.trainStartDttm,
|
||||
this.step1EndDttm,
|
||||
this.step1Duration,
|
||||
this.step2EndDttm,
|
||||
this.step2Duration,
|
||||
this.step1Status,
|
||||
this.step2Status,
|
||||
this.transferStatus);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user