diff --git a/testarena_app/worker.py b/testarena_app/worker.py index 2696eb1..50ca991 100644 --- a/testarena_app/worker.py +++ b/testarena_app/worker.py @@ -156,13 +156,15 @@ def run_worker(): try: # Run scenario_execution.py queue_id scenario_path task_id - script_path = "./TPF/scenario_execution.py" - cmd = f"python3 {script_path} {queue.id} {task.scenario_path} {task.id}" + # It must be executed from TPF/Sensor_hub_repo with IDF sourced + script_path = os.path.abspath("./TPF/scenario_execution.py") + 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}'" task_dir = os.path.join(queue_dir, task.id) os.makedirs(task_dir, exist_ok=True) - ret = run_command_with_logging(cmd, queue_log) + ret = run_command_with_logging(cmd, queue_log, cwd=repo_dir) if ret == 0: task.status = "Finished"