From 87e886320836672e285e59138b7fa96ed1187991 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 17 Sep 2026 17:59:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(deploy):=20start.sh=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E6=80=81=E5=BC=80=E5=85=B3(conf/compiled=5Fmode=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E8=B5=B0overlay=20runner,=E5=88=A0=E9=99=A4=E5=8D=B3?= =?UTF-8?q?=E5=9B=9E=E9=80=80=E6=BA=90=E7=A0=81=E6=80=81)+accounting=20wor?= =?UTF-8?q?ker=E7=BC=96=E8=AF=91runner;web/worker/all=E4=B8=89=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=85=B1=E7=94=A8ENTRY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/build_binary.sh | 12 ++++++++++++ start.sh | 17 +++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/scripts/build_binary.sh b/scripts/build_binary.sh index 372b26f..5be106d 100644 --- a/scripts/build_binary.sh +++ b/scripts/build_binary.sh @@ -164,6 +164,18 @@ import pipeline_app pipeline_app.main() EOS +cat > "$OUT/_appbin/run_accounting_compiled.py" <<'EOS' +#!/usr/bin/env python3 +"""编译态记账 worker runner:sys.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" diff --git a/start.sh b/start.sh index f9acf22..a15ca09 100755 --- a/start.sh +++ b/start.sh @@ -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-17):conf/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