containerName 생성 변경
This commit is contained in:
@@ -47,7 +47,8 @@ public class ModelTrainJobCoreService {
|
|||||||
|
|
||||||
/** 실행 시작 처리 */
|
/** 실행 시작 처리 */
|
||||||
@Transactional
|
@Transactional
|
||||||
public void markRunning(Long jobId, String containerName, String logPath, String lockedBy) {
|
public void markRunning(
|
||||||
|
Long jobId, String containerName, String logPath, String lockedBy, Integer totalEpoch) {
|
||||||
ModelTrainJobEntity job =
|
ModelTrainJobEntity job =
|
||||||
modelTrainJobRepository
|
modelTrainJobRepository
|
||||||
.findById(jobId)
|
.findById(jobId)
|
||||||
@@ -59,6 +60,10 @@ public class ModelTrainJobCoreService {
|
|||||||
job.setStartedDttm(ZonedDateTime.now());
|
job.setStartedDttm(ZonedDateTime.now());
|
||||||
job.setLockedDttm(ZonedDateTime.now());
|
job.setLockedDttm(ZonedDateTime.now());
|
||||||
job.setLockedBy(lockedBy);
|
job.setLockedBy(lockedBy);
|
||||||
|
|
||||||
|
if (totalEpoch != null) {
|
||||||
|
job.setTotalEpoch(totalEpoch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 성공 처리 */
|
/** 성공 처리 */
|
||||||
|
|||||||
@@ -78,6 +78,12 @@ public class ModelTrainJobEntity {
|
|||||||
@Column(name = "locked_by", length = 100)
|
@Column(name = "locked_by", length = 100)
|
||||||
private String lockedBy;
|
private String lockedBy;
|
||||||
|
|
||||||
|
@Column(name = "total_epoch")
|
||||||
|
private Integer totalEpoch;
|
||||||
|
|
||||||
|
@Column(name = "current_epoch")
|
||||||
|
private Integer currentEpoch;
|
||||||
|
|
||||||
public ModelTrainJobDto toDto() {
|
public ModelTrainJobDto toDto() {
|
||||||
return new ModelTrainJobDto(
|
return new ModelTrainJobDto(
|
||||||
this.id,
|
this.id,
|
||||||
@@ -90,6 +96,8 @@ public class ModelTrainJobEntity {
|
|||||||
this.paramsJson,
|
this.paramsJson,
|
||||||
this.queuedDttm,
|
this.queuedDttm,
|
||||||
this.startedDttm,
|
this.startedDttm,
|
||||||
this.finishedDttm);
|
this.finishedDttm,
|
||||||
|
this.totalEpoch,
|
||||||
|
this.currentEpoch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,6 @@ public class ModelTrainJobDto {
|
|||||||
private ZonedDateTime queuedDttm;
|
private ZonedDateTime queuedDttm;
|
||||||
private ZonedDateTime startedDttm;
|
private ZonedDateTime startedDttm;
|
||||||
private ZonedDateTime finishedDttm;
|
private ZonedDateTime finishedDttm;
|
||||||
|
private Integer totalEpoch;
|
||||||
|
private Integer currentEpoch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class DockerTrainService {
|
|||||||
log.info("[EPOCH] container={} {}/{}", containerName, currentEpoch, totalEpoch);
|
log.info("[EPOCH] container={} {}/{}", containerName, currentEpoch, totalEpoch);
|
||||||
|
|
||||||
// TODO 실행중인 에폭 저장 필요하면 만들어야함
|
// TODO 실행중인 에폭 저장 필요하면 만들어야함
|
||||||
// TODO 완료여부를 여기다가?
|
// TODO 하지만 여기서 트랜젝션 걸리는 db 작업하면 안좋다고하는데..?
|
||||||
// modelTrainMngCoreService.updateCurrentEpoch(modelId,
|
// modelTrainMngCoreService.updateCurrentEpoch(modelId,
|
||||||
// currentEpoch, totalEpoch);
|
// currentEpoch, totalEpoch);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public class TrainJobService {
|
|||||||
Map<String, Object> paramsMap = objectMapper.convertValue(trainRunRequest, Map.class);
|
Map<String, Object> paramsMap = objectMapper.convertValue(trainRunRequest, Map.class);
|
||||||
paramsMap.put("jobType", "TRAIN");
|
paramsMap.put("jobType", "TRAIN");
|
||||||
paramsMap.put("uuid", trainRunRequest.getUuid());
|
paramsMap.put("uuid", trainRunRequest.getUuid());
|
||||||
|
paramsMap.put("totalEpoch", trainRunRequest.getEpochs());
|
||||||
|
|
||||||
Long jobId =
|
Long jobId =
|
||||||
modelTrainJobCoreService.createQueuedJob(
|
modelTrainJobCoreService.createQueuedJob(
|
||||||
|
|||||||
@@ -47,9 +47,17 @@ public class TrainJobWorker {
|
|||||||
|
|
||||||
boolean isEval = "EVAL".equals(jobType);
|
boolean isEval = "EVAL".equals(jobType);
|
||||||
|
|
||||||
String containerName = (isEval ? "eval-" : "train-") + jobId + "-" + params.get("uuid");
|
String containerName =
|
||||||
|
(isEval ? "eval-" : "train-") + jobId + "-" + params.get("uuid").toString().substring(0, 8);
|
||||||
|
|
||||||
modelTrainJobCoreService.markRunning(jobId, containerName, null, "TRAIN_WORKER");
|
Integer totalEpoch = null;
|
||||||
|
if (params.containsKey("totalEpoch")) {
|
||||||
|
if (params.get("totalEpoch") != null) {
|
||||||
|
totalEpoch = Integer.parseInt(params.get("totalEpoch").toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modelTrainJobCoreService.markRunning(jobId, containerName, null, "TRAIN_WORKER", totalEpoch);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TrainRunResult result;
|
TrainRunResult result;
|
||||||
|
|||||||
Reference in New Issue
Block a user