Files
market_sync/bin/market_sync_morning_run.sh
gao 8f016f25df chore: baseline — ORM migration + systemd deploy + MCP server + daily check
- ORM migration: models/ops 重构
- deploy: 标准化 systemd timer/service 部署体系
- MCP server: 5 个只读工具(任务/状态/数据集)
- daily check: 数据一致性巡检
- watch: task_watch 后台监控
- kline_daily: 麦蕊优先,时间门禁15:00
- 删除: task_industry_sector, task_sector_features
2026-07-21 16:37:00 +08:00

44 lines
1.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 早盘前同步:stock_basic(仅)
# - stock_basic:雪球 quote_detail 拉全市场股本快照(~9min @ 5 RPS
# - 与 runall_once.py 区别:不拉 kline_daily / kline_5min 等耗时长任务
set -u
PROJECT_ROOT="/home/gao/Development/quant_home/market_sync"
LOG_DIR="$PROJECT_ROOT/logs"
mkdir -p "$LOG_DIR"
TS=$(date +%Y%m%d_%H%M%S)
LOG="$LOG_DIR/morning_run_${TS}.log"
cd "$PROJECT_ROOT"
exec .venv/bin/python -c "
import sys, time
sys.path.insert(0, '$PROJECT_ROOT')
from app.core.datasource.registry import build_default_registry
from app.core.sync.registry import seed_sync_registry
build_default_registry()
seed_sync_registry()
from app.tasks import get_task
results = []
for tid in ['stock_basic']:
print(f'[morning-run] >>> 开始 {tid}', flush=True)
t0 = time.time()
try:
r = get_task(tid).run(trigger_source='morning_runall')
elapsed = round(time.time() - t0, 1)
results.append({'task': tid, 'status': r.get('status'), 'elapsed_sec': elapsed, 'message': r.get('message', '')})
print(f'[morning-run] <<< {tid} status={r.get(\"status\")} elapsed={elapsed}s msg={r.get(\"message\", \"\")}', flush=True)
except Exception as e:
elapsed = round(time.time() - t0, 1)
results.append({'task': tid, 'status': 'error', 'elapsed_sec': elapsed, 'message': str(e)})
print(f'[morning-run] !!! {tid} 异常: {e}', flush=True)
time.sleep(5)
import json
print('[morning-run] summary:', json.dumps(results, ensure_ascii=False))
" > "$LOG" 2>&1