update DB table
This commit is contained in:
@@ -37,14 +37,17 @@ EOF
|
|||||||
|
|
||||||
# 1. CD into the repo path
|
# 1. CD into the repo path
|
||||||
# 2. Execute command and capture output
|
# 2. Execute command and capture output
|
||||||
# 3. PIPESTATUS[1] captures the exit code of the CMD, not the 'cd' or 'tee'
|
# 3. PIPESTATUS[0] captures the exit code of the eval "$CMD"
|
||||||
|
echo "--- Execution Start ---" | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
||||||
cd "$REPO_PATH" && eval "$CMD" 2>&1 | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
cd "$REPO_PATH" && eval "$CMD" 2>&1 | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
||||||
EXIT_CODE=${PIPESTATUS[0]}
|
EXIT_CODE=${PIPESTATUS[0]}
|
||||||
|
echo "--- Execution End (Exit Code: $EXIT_CODE) ---" | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
||||||
|
|
||||||
# Close HTML tags
|
# Close HTML tags
|
||||||
echo "</div></body></html>" >> "$LOG_FILE"
|
echo "</div></body></html>" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Determine PASS/FAIL
|
# Determine PASS/FAIL
|
||||||
|
# We consider it a FAIL if the exit code is non-zero
|
||||||
if [ $EXIT_CODE -eq 0 ]; then
|
if [ $EXIT_CODE -eq 0 ]; then
|
||||||
RESULT="PASS"
|
RESULT="PASS"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Group=asf
|
|||||||
WorkingDirectory=/home/asf/testarena_backend
|
WorkingDirectory=/home/asf/testarena_backend
|
||||||
Environment="PATH=/home/asf/testarena_backend/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
Environment="PATH=/home/asf/testarena_backend/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
Environment="IDF_PATH=/home/asf/esp/esp-idf"
|
Environment="IDF_PATH=/home/asf/esp/esp-idf"
|
||||||
|
Environment="XDG_RUNTIME_DIR=/tmp"
|
||||||
Environment="DATABASE_URL=sqlite:////home/asf/testarena/testarena.db"
|
Environment="DATABASE_URL=sqlite:////home/asf/testarena/testarena.db"
|
||||||
ExecStart=/home/asf/testarena_backend/venv/bin/uvicorn testarena_app.main:app --host 0.0.0.0 --port 8000
|
ExecStart=/home/asf/testarena_backend/venv/bin/uvicorn testarena_app.main:app --host 0.0.0.0 --port 8000
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Group=asf
|
|||||||
WorkingDirectory=/home/asf/testarena_backend
|
WorkingDirectory=/home/asf/testarena_backend
|
||||||
Environment="PATH=/home/asf/testarena_backend/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
Environment="PATH=/home/asf/testarena_backend/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
Environment="IDF_PATH=/home/asf/esp/esp-idf"
|
Environment="IDF_PATH=/home/asf/esp/esp-idf"
|
||||||
|
Environment="XDG_RUNTIME_DIR=/tmp"
|
||||||
Environment="DATABASE_URL=sqlite:////home/asf/testarena/testarena.db"
|
Environment="DATABASE_URL=sqlite:////home/asf/testarena/testarena.db"
|
||||||
ExecStart=/home/asf/testarena_backend/venv/bin/python3 -m testarena_app.worker
|
ExecStart=/home/asf/testarena_backend/venv/bin/python3 -m testarena_app.worker
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ def update_json_status(queue_id, task_id, status, result=None):
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
|
|
||||||
|
os.environ["XDG_RUNTIME_DIR"] = "/tmp"
|
||||||
|
|
||||||
def run_command_with_logging(cmd, log_file, cwd=None, env=None, timeout=1800, stop_string=None):
|
def run_command_with_logging(cmd, log_file, cwd=None, env=None, timeout=1800, stop_string=None):
|
||||||
"""Runs a command, logs output, and optionally stops when a string is found."""
|
"""Runs a command, logs output, and optionally stops when a string is found."""
|
||||||
|
|||||||
Reference in New Issue
Block a user