本项目日常运维、调试、测试命令汇总
cd /home/ubuntu/demand_crawler_mvp && venv/bin/python demand_crawler.py
手动执行一次完整抓取、分类、评分流程。
# 增量处理未 enrichment 的记录venv/bin/python scripts/enrich_with_llm.py
# 全量重新处理所有记录venv/bin/python scripts/enrich_with_llm.py --all
# 只处理最新 50 条venv/bin/python scripts/enrich_with_llm.py --limit 50
需要先配置 LLM_API_KEY、LLM_MODEL、LLM_ENRICH_ENABLED=1。
venv/bin/python -m pytest tests/ -q --ignore=tests/test_freelancer_collector.py --ignore=tests/test_llm_enrichment.py --ignore=tests/test_llm_client.py
排除外部依赖较长的测试后,快速跑完核心测试。
# 宝塔启动脚本(推荐在宝塔面板里操作)sudo bash /www/server/python_project/vhost/scripts/demand_crawler_mvp_gunicorn.sh
# 查看当前进程ps -ef | grep gunicorn | grep -v grep
# 停止服务(如需重启,先停后跑启动脚本)pid=$(cat /www/server/python_project/vhost/pids/demand_crawler_mvp.pid); sudo kill $pid
注意:demand-dashboard.service 已停用,不再使用 systemd 管理。
crontab -l
查看当前定时任务。抓取脚本每 2 小时执行一次。
# 查看最近一次抓取venv/bin/python -c "from dashboard import queries; print(queries.get_latest_run(queries.get_repo()))"
# 手动应用迁移venv/bin/python -c "from src.demand_intelligence.storage import DemandRepository; DemandRepository().ensure_schema()"
# 统计未 enrichment 数量venv/bin/python -c "from src.demand_intelligence.storage import DemandRepository; r=DemandRepository(); cur=r._connect().cursor(); cur.execute('SELECT COUNT(*) FROM normalized_opportunities WHERE is_llm_enriched=false'); print(cur.fetchone()[0])"
logs/cron.logdashboard/app.logoutput/llm_reports/.env.env.example/www/server/python_project/vhost/env/demand_crawler_mvp.env