Skip to content

Commit

Permalink
Merge pull request #299 from xtreme1-io/dev
Browse files Browse the repository at this point in the history
Bug fixes.
  • Loading branch information
jaggerwang authored Nov 18, 2024
2 parents eee3441 + d49e75a commit 19a13af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions backend/src/main/java/ai/basic/x1/usecase/ExportUseCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,26 @@ private <Q extends BaseQueryBO> 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);
if (FileUtil.exist(respPath) && UsecaseCode.OK.equals(DefaultConverter.convert(JSONUtil.readJSONObject(FileUtil.file(respPath), Charset.defaultCharset()), ApiResult.class).getCode())) {
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 {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/java/ai/basic/x1/util/DataFormatUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit 19a13af

Please sign in to comment.