diff --git a/backend/Dockerfile b/backend/Dockerfile index 7ba02213..d58f6d80 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -7,7 +7,7 @@ RUN --mount=type=cache,target=/root/.m2 mvn package FROM openjdk:11-jre RUN apt update && \ apt install -y iputils-ping curl wget netcat python3 python3-pip git -RUN pip3 install --upgrade --force-reinstall git+https://github.com/xtreme1-io/xtreme1-sdk.git@d0cf4cc +RUN pip3 install --upgrade --force-reinstall git+https://github.com/xtreme1-io/xtreme1-sdk.git@6b53a73 WORKDIR /app COPY --from=build /build/target/xtreme1-backend-0.9.1-SNAPSHOT.jar ./app.jar RUN mkdir -p config diff --git a/backend/src/main/java/ai/basic/x1/usecase/ExportUseCase.java b/backend/src/main/java/ai/basic/x1/usecase/ExportUseCase.java index 1fbd637a..92461c88 100644 --- a/backend/src/main/java/ai/basic/x1/usecase/ExportUseCase.java +++ b/backend/src/main/java/ai/basic/x1/usecase/ExportUseCase.java @@ -144,12 +144,13 @@ private void getDataAndUpload(ExportRecord record, Strin var zipPath = srcPath + ".zip"; File zipFile; var path = String.format("%s/%s", rootPath, FileUtil.getName(zipPath)); + if (DataFormatEnum.COCO.equals(query.getDataFormat())) { var basePath = String.format("%s/%s", tempPath, IdUtil.fastSimpleUUID()); var respPath = String.format("%s/resp.json", basePath); var baseOutPath = String.format("%s/%s", basePath, FileUtil.getPrefix(zipPath)); var outPathNew = String.format("%s/result", baseOutPath); - FileUtil.move(Path.of(String.format("%s/image", srcPath)), Path.of(String.format("%s/image", baseOutPath)), true); + //FileUtil.move(Path.of(String.format("%s/image", srcPath)), Path.of(String.format("%s/image", baseOutPath)), true); ZipUtil.zip(srcPath, zipPath, true); FileUtil.mkdir(outPathNew); DataFormatUtil.convert(Constants.CONVERT_EXPORT, zipPath, outPathNew, respPath); @@ -157,7 +158,12 @@ private void getDataAndUpload(ExportRecord record, Strin zipFile = ZipUtil.zip(baseOutPath, zipPath, true); } else { FileUtil.del(basePath); - throw new UsecaseException("convert coco error"); + var exportRecordBO = exportRecordBOBuilder + .status(ExportStatusEnum.FAILED) + .updatedAt(OffsetDateTime.now()) + .build(); + exportRecordUsecase.saveOrUpdate(exportRecordBO); + return; } FileUtil.del(basePath); } else { diff --git a/backend/src/main/java/ai/basic/x1/util/DataFormatUtil.java b/backend/src/main/java/ai/basic/x1/util/DataFormatUtil.java index 2031836d..72f2e1d8 100644 --- a/backend/src/main/java/ai/basic/x1/util/DataFormatUtil.java +++ b/backend/src/main/java/ai/basic/x1/util/DataFormatUtil.java @@ -15,7 +15,7 @@ public static void convert(String type, String srcPath, String outPath, String r FileUtil.mkParentDirs(respPath); ProcessBuilder builder = new ProcessBuilder(); FileUtil.mkParentDirs(respPath); - String command = String.format("xtreme1_ctl --mode '%s' -src '%s' -out '%s' --rps '%s' --format=coco", type, srcPath, outPath, respPath); + String command = String.format("script_ctl --mode '%s' --src '%s' --dst '%s' --rps '%s' --fmt=coco", type, srcPath, outPath, respPath); builder.command("sh", "-c", command); Process process = builder.start(); BufferedReader in = new BufferedReader(new InputStreamReader(process.getErrorStream()));