From 45e0c7d9caf62805495fa3d499a91909ba64363f Mon Sep 17 00:00:00 2001 From: Lucas Armand Date: Mon, 24 Nov 2025 15:02:33 -0800 Subject: [PATCH] Move model log rotate to top --- start_server.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/start_server.sh b/start_server.sh index edc16a4..dd57b5a 100755 --- a/start_server.sh +++ b/start_server.sh @@ -41,6 +41,14 @@ echo_var DEBUG_LOG echo_var PYWORKER_LOG echo_var MODEL_LOG +# if instance is rebooted, we want to clear out the log file so pyworker doesn't read lines +# from the run prior to reboot. past logs are saved in $MODEL_LOG.old for debugging only +if [ -e "$MODEL_LOG" ]; then + echo "Rotating model log at $MODEL_LOG to $MODEL_LOG.old" + cat "$MODEL_LOG" >> "$MODEL_LOG.old" + : > "$MODEL_LOG" +fi + # Populate /etc/environment with quoted values if ! grep -q "VAST" /etc/environment; then env -0 | grep -zEv "^(HOME=|SHLVL=)|CONDA" | while IFS= read -r -d '' line; do @@ -124,9 +132,7 @@ cd "$SERVER_DIR" echo "launching PyWorker server" -# if instance is rebooted, we want to clear out the log file so pyworker doesn't read lines -# from the run prior to reboot. past logs are saved in $MODEL_LOG.old for debugging only -[ -e "$MODEL_LOG" ] && cat "$MODEL_LOG" >> "$MODEL_LOG.old" && : > "$MODEL_LOG" +# Model log line used to be here ! (python3 -m "workers.$BACKEND.server" |& tee -a "$PYWORKER_LOG") & echo "launching PyWorker server done"