update DB table
This commit is contained in:
@@ -77,13 +77,16 @@ def run_test_suite(tasks):
|
|||||||
print(f"--- Starting Task: {task['id']} ---")
|
print(f"--- Starting Task: {task['id']} ---")
|
||||||
|
|
||||||
# Use Popen to stream output in real-time
|
# Use Popen to stream output in real-time
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["PYTHONUNBUFFERED"] = "1"
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
[shell_script, task['id'], task['cmd'], task['path'], REPO_PATH],
|
[shell_script, task['id'], task['cmd'], task['path'], REPO_PATH],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
text=True,
|
text=True,
|
||||||
bufsize=1,
|
bufsize=1,
|
||||||
universal_newlines=True
|
universal_newlines=True,
|
||||||
|
env=env
|
||||||
)
|
)
|
||||||
|
|
||||||
full_output = ""
|
full_output = ""
|
||||||
|
|||||||
@@ -38,8 +38,9 @@ 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[0] captures the exit code of the eval "$CMD"
|
# 3. PIPESTATUS[0] captures the exit code of the eval "$CMD"
|
||||||
|
export PYTHONUNBUFFERED=1
|
||||||
echo "--- Execution Start ---" | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
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" && stdbuf -oL -eL 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")
|
echo "--- Execution End (Exit Code: $EXIT_CODE) ---" | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
||||||
|
|
||||||
|
|||||||
@@ -139,9 +139,12 @@ def run_worker():
|
|||||||
checkout_cmd = f"./TPF/gitea_repo_controller.sh checkout {queue.source}"
|
checkout_cmd = f"./TPF/gitea_repo_controller.sh checkout {queue.source}"
|
||||||
run_command_with_logging(checkout_cmd, queue_log)
|
run_command_with_logging(checkout_cmd, queue_log)
|
||||||
|
|
||||||
|
# Clean up any orphaned QEMU processes
|
||||||
|
run_command_with_logging("pkill -f qemu-system-xtensa || true", queue_log)
|
||||||
|
|
||||||
# 1-5 Build software and run QEMU
|
# 1-5 Build software and run QEMU
|
||||||
# We stop when we see the multicore app start message
|
# We stop when we see the multicore app start message
|
||||||
build_cmd = f"/bin/bash -c 'source $HOME/esp/esp-idf/export.sh && cd TPF/Sensor_hub_repo && idf.py build && idf.py qemu'"
|
build_cmd = f"/bin/bash -c 'export PYTHONUNBUFFERED=1 && source $HOME/esp/esp-idf/export.sh && cd TPF/Sensor_hub_repo && idf.py build && idf.py qemu'"
|
||||||
run_command_with_logging(build_cmd, queue_log, stop_string="cpu_start: Multicore app")
|
run_command_with_logging(build_cmd, queue_log, stop_string="cpu_start: Multicore app")
|
||||||
|
|
||||||
# 9- Loop for each task
|
# 9- Loop for each task
|
||||||
@@ -162,7 +165,7 @@ def run_worker():
|
|||||||
# It must be executed from TPF/Sensor_hub_repo with IDF sourced
|
# It must be executed from TPF/Sensor_hub_repo with IDF sourced
|
||||||
script_path = os.path.abspath("./TPF/scenario_execution.py")
|
script_path = os.path.abspath("./TPF/scenario_execution.py")
|
||||||
repo_dir = os.path.abspath("./TPF/Sensor_hub_repo")
|
repo_dir = os.path.abspath("./TPF/Sensor_hub_repo")
|
||||||
cmd = f"/bin/bash -c 'source $HOME/esp/esp-idf/export.sh && python3 {script_path} {queue.id} {task.scenario_path} {task.id}'"
|
cmd = f"/bin/bash -c 'export PYTHONUNBUFFERED=1 && source $HOME/esp/esp-idf/export.sh && python3 {script_path} {queue.id} {task.scenario_path} {task.id}'"
|
||||||
|
|
||||||
task_dir = os.path.join(queue_dir, task.id)
|
task_dir = os.path.join(queue_dir, task.id)
|
||||||
os.makedirs(task_dir, exist_ok=True)
|
os.makedirs(task_dir, exist_ok=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user