Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions infra/sandbox/src/services/container-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,12 @@ class ContainerService {
}
);

stream.on("data", (chunk: Buffer) => {
logger.info(`${chunk.toString()}`, {
containerId: container.id,
});
});

stream.on("end", () => {
resolve({ stdout, stderr });
});
Expand Down
8 changes: 8 additions & 0 deletions infra/sandbox/src/services/dependency-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class NodePackageHandler implements DependencyHandler {
}
);

stream.on("data", (chunk: Buffer) => {
logger.info(`${chunk.toString()}`, { position: 'NodePackageHandler', containerId: container.id });
});

stream.on("end", async () => {
try {
const inspectData = await exec.inspect();
Expand Down Expand Up @@ -186,6 +190,10 @@ class PythonPackageHandler implements DependencyHandler {
}
);

stream.on("data", (chunk: Buffer) => {
logger.info(`${chunk.toString()}`, { position: 'PythonPackageHandler', containerId: container.id });
});

stream.on("end", async () => {
try {
const inspectData = await exec.inspect();
Expand Down
7 changes: 7 additions & 0 deletions infra/sandbox/src/services/execution-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ class ExecutionService {
}
);

stream.on("data", (chunk: Buffer) => {
logger.info(`${chunk.toString()}`, {
containerId: container.id,
});
});

stream.on("end", async () => {
try {
const inspectData = await exec.inspect();
Expand Down Expand Up @@ -418,6 +424,7 @@ class ExecutionService {
});
});
}

}

export default new ExecutionService();
10 changes: 7 additions & 3 deletions infra/sandbox/src/services/file-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ApiError } from "../middleware/error-handler";
import { SandboxFiles } from "../types";
import gitService from "./git-service";
import dockerConfig from "./docker-config";
import tar from 'tar-stream'

// 固定工作目录,所有代码都存放在这里,由Git管理版本
const WORK_DIR = "/home/sandbox";
Expand Down Expand Up @@ -363,7 +364,6 @@ class FileService {
});

// Extract the zip file from the tar archive
const tar = require("tar-stream");
const extract = tar.extract();

// Use promise to properly handle async extraction
Expand All @@ -376,6 +376,7 @@ class FileService {

stream.on("data", (chunk: Buffer) => {
chunks.push(chunk);
logger.info(`${chunk.toString()}`, { position: 'FileService', containerId: container.id });
});

stream.on("end", () => {
Expand Down Expand Up @@ -501,6 +502,10 @@ class FileService {
}
);

stream.on("data", (chunk: Buffer) => {
logger.info(`${chunk.toString()}`, { position: 'FileService', containerId: container.id });
});

stream.on("end", () => {
resolve({ stdout, stderr });
});
Expand Down Expand Up @@ -530,8 +535,7 @@ class FileService {
// Read the file content
const content = fs.readFileSync(localPath);

// Create a tar stream with the file
const pack = require("tar-stream").pack();
const pack = tar.pack();

// Add file to the tar stream
const fileName = path.basename(containerPath);
Expand Down
4 changes: 4 additions & 0 deletions infra/sandbox/src/services/git-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,10 @@ Thumbs.db
}
);

stream.on("data", (chunk: Buffer) => {
logger.info(`${chunk.toString()}`, { position: 'GitService', containerId: container.id });
});

stream.on("end", () => {
resolve({ stdout, stderr });
});
Expand Down
Loading