[KC-108] ai api batch 작업중

This commit is contained in:
2026-01-12 20:34:07 +09:00
parent a5a5b034b4
commit a2d9dfc036
6 changed files with 95 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.InferenceBatchSheet;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
import com.kamco.cd.kamcoback.scheduler.dto.JobStatusDto;
@@ -37,10 +38,10 @@ public class MapSheetInferenceJobService {
try {
// TODO: 배치 로직 작성
Long batchId =
InferenceBatchSheet batchSheet =
inferenceResultCoreService.getInferenceResultByStatus(Status.IN_PROGRESS.getId());
if (batchId == null) {
if (batchSheet == null) {
return;
}
@@ -48,6 +49,16 @@ public class MapSheetInferenceJobService {
headers.setContentType(MediaType.APPLICATION_JSON);
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
Long batchId = 0L;
if (batchSheet.getM3BatchId() != null) {
batchId = batchSheet.getM3BatchId();
} else if (batchSheet.getM2BatchId() != null) {
batchId = batchSheet.getM2BatchId();
} else if (batchSheet.getM1BatchId() != null) {
batchId = batchSheet.getM1BatchId();
}
String url = batchUrl + "/" + batchId;
ExternalCallResult<String> result =
@@ -61,6 +72,12 @@ public class MapSheetInferenceJobService {
String json = result.body();
JobStatusDto dto = objectMapper.readValue(json, JobStatusDto.class);
if ("COMPLETED".equals(dto.getStatus())) {
String type = batchSheet.getRunningModelType();
// if(type.equals("M3"))
}
System.out.println(dto);
Thread.sleep(3000); // 예시: 처리 시간 3초