feat(deploy): start.sh编译态开关(conf/compiled_mode存在走overlay runner,删除即回退源码态)+accounting worker编译runner;web/worker/all三模式共用ENTRY

This commit is contained in:
yumoqing 2026-09-17 17:59:18 +08:00
parent b51de027ae
commit 87e8863208
2 changed files with 27 additions and 2 deletions

View File

@ -164,6 +164,18 @@ import pipeline_app
pipeline_app.main()
EOS
cat > "$OUT/_appbin/run_accounting_compiled.py" <<'EOS'
#!/usr/bin/env python3
"""编译态记账 worker runnersys.argv 透传(-w workdir。"""
import os, sys
_here = os.path.dirname(os.path.abspath(__file__))
_overlay = os.path.dirname(_here)
sys.path.insert(0, _overlay)
sys.path.insert(0, _here)
import pipeline_accounting_worker
pipeline_accounting_worker.main()
EOS
# BUILD_INFO逐仓哈希部署对账/回滚点用)
HASHF=$WORK/hashes.jsonl
: > "$HASHF"

View File

@ -34,7 +34,15 @@ fi
echo "Starting pipeline-app ($MODE mode) on port $PORT..."
export PATH="$WORKDIR/bin:$PATH"
$WORKDIR/py3/bin/python $WORKDIR/app/pipeline_app.py -p $PORT -w $WORKDIR >> $WORKDIR/logs/pipeline.log 2>&1 &
# Nuitka 编译态开关2026-09-17conf/compiled_mode 文件存在 → 用 overlay 的编译入口;
# 删除该文件即回退源码态。overlay 与 runner 由 scripts/build_binary.sh 产出(测试机构建)。
COMPILED_ENTRY=$WORKDIR/binpkg_overlay/_appbin/run_compiled.py
if [ -f "$WORKDIR/conf/compiled_mode" ] && [ -f "$COMPILED_ENTRY" ]; then
ENTRY="$COMPILED_ENTRY"
else
ENTRY="$WORKDIR/app/pipeline_app.py"
fi
$WORKDIR/py3/bin/python $ENTRY -p $PORT -w $WORKDIR >> $WORKDIR/logs/pipeline.log 2>&1 &
echo $! > "$PIDFILE"
echo "Started PID $(cat $PIDFILE)"
@ -51,7 +59,12 @@ if [ "$MODE" != "web" ]; then
fi
fi
if [ ! -f "$ACC_PIDFILE" ]; then
$WORKDIR/py3/bin/python $WORKDIR/app/pipeline_accounting_worker.py -w $WORKDIR >> $WORKDIR/logs/pipeline-accounting.log 2>&1 &
if [ -f "$WORKDIR/conf/compiled_mode" ] && [ -f "$WORKDIR/binpkg_overlay/_appbin/run_accounting_compiled.py" ]; then
ACC_ENTRY="$WORKDIR/binpkg_overlay/_appbin/run_accounting_compiled.py"
else
ACC_ENTRY="$WORKDIR/app/pipeline_accounting_worker.py"
fi
$WORKDIR/py3/bin/python $ACC_ENTRY -w $WORKDIR >> $WORKDIR/logs/pipeline-accounting.log 2>&1 &
echo $! > "$ACC_PIDFILE"
echo "Started accounting worker PID $(cat $ACC_PIDFILE)"
fi