/** * PM2 进程守护配置 * 标准安装路径: /opt/Trading_Studio * 用法: pm2 start ecosystem.config.js */ const path = require("path"); const APP_DIR = __dirname; module.exports = { apps: [ { name: "trading_studio", script: path.join(APP_DIR, "app.py"), interpreter: path.join(APP_DIR, "venv/bin/python"), cwd: APP_DIR, instances: 1, autorestart: true, watch: false, max_memory_restart: "6G", env: { PYTHONUNBUFFERED: "1", CUDA_VISIBLE_DEVICES: "0", PYTORCH_CUDA_ALLOC_CONF: "expandable_segments:True", }, error_file: path.join(APP_DIR, "logs/pm2-error.log"), out_file: path.join(APP_DIR, "logs/pm2-out.log"), log_date_format: "YYYY-MM-DD HH:mm:ss", merge_logs: true, }, ], };