diff --git a/data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/service/code/impls/AbstractCodePoolExecutorService.java b/data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/service/code/impls/AbstractCodePoolExecutorService.java index d51db20c1..15632d702 100644 --- a/data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/service/code/impls/AbstractCodePoolExecutorService.java +++ b/data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/service/code/impls/AbstractCodePoolExecutorService.java @@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.File; import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Files; @@ -303,6 +302,11 @@ private TaskResponse pushTaskQueue(TaskRequest request) throws ExecutionExceptio return this.runTask(request); }); this.taskQueue.put(ft); + + if (!this.readyCoreContainer.isEmpty() || !this.readyTempContainer.isEmpty()) { + this.popTaskQueue(); + } + return ft.get(); } @@ -406,28 +410,6 @@ public FileVisitResult postVisitDirectory(@NotNull Path dir, @Nullable IOExcepti } } - /** - * Create writable temporary file - * @param tempDir temporary directory - * @param fileName file name - * @throws IOException IO exception - */ - protected void createWritableFile(Path tempDir, String fileName) throws IOException { - File file = new File(tempDir.resolve(fileName).toUri()); - if (file.exists()) { - if (!file.setWritable(true, false)) { - throw new IOException("Cannot write to existing file: " + file.getAbsolutePath()); - } - return; - } - if (!file.createNewFile()) { - throw new IOException("Failed to create file: " + file.getAbsolutePath()); - } - if (!file.setWritable(true, false)) { - throw new IOException("Cannot write to existing file: " + file.getAbsolutePath()); - } - } - /** * Generate unique container name */