feat: add Python install script for on-demand AI feature bundles

Reads the feature manifest, installs pip packages (common + arch-specific),
downloads models in parallel with atomic rename, and writes installed.json.
Includes disk space pre-check, NCCL conflict handling, retry logic, and
progress reporting via stderr JSON lines. Also updates the feature route
to pass manifestPath and modelsDir as CLI arguments.
This commit is contained in:
ashim-hq
2026-04-18 02:37:43 +08:00
parent cadb0f8071
commit 7ffbd5e3c6
2 changed files with 454 additions and 1 deletions
+3 -1
View File
@@ -129,8 +129,10 @@ export async function registerFeatureRoutes(app: FastifyInstance): Promise<void>
const jobId = crypto.randomUUID();
const scriptPath = join(process.cwd(), "packages/ai/python/install_feature.py");
const manifestPath = getManifestPath();
const modelsDir = getModelsDir();
const child = spawn(pythonPath, [scriptPath, bundleId], {
const child = spawn(pythonPath, [scriptPath, bundleId, manifestPath, modelsDir], {
stdio: ["ignore", "ignore", "pipe"],
env: {
...process.env,