fix: 15 bug fixes across orchestrator, runner, backtest, and infrastructure

Critical:
- strategy_orchestrator: fix IndentationError that prevented import (line 764)
- factor_runner: fix literal 'sys.executable' string → variable (line 966)

High (path bugs causing wrong directories):
- backtest_engine: fix results_path depth (3→4 .parent hops)
- results_db: fix factors_dir/failed_dir depth (3→4 .parent hops)
- factor_runner: eliminate run_id variable shadowing (parallel_run_id/db_run_id)
- model_runner: fix DB connection leak on add_backtest exception
- optuna_optimizer: fix imported logger shadowed by module-level reassignment

Medium:
- env: handle non-UTF-8 Docker build output with errors='replace'
- env: guard conda env list parsing against empty lines
- factor_runner: add check=False + stderr logging for full-data subprocess
- strategy_orchestrator: log exec() exceptions at ERROR level with traceback
- strategy_orchestrator: warn on unreplaced {{template}} variables in prompts

Low:
- factor_runner: guard IC_max.index access against scalar (AttributeError)
- predix_parallel: close log file handle on Popen failure
- predix_rebacktest_strategies: replace 4 bare except: with except Exception:
This commit is contained in:
TPTBusiness
2026-05-03 09:37:00 +02:00
parent 28766c932e
commit aba88dd090
8 changed files with 331 additions and 32 deletions
+14 -10
View File
@@ -230,16 +230,20 @@ class ParallelRunner:
log_path = self.project_root / run_state.log_file
log_f = open(log_path, "a", encoding="utf-8")
# Start subprocess
run_state.process = subprocess.Popen(
cmd,
env=env,
cwd=str(self.project_root),
stdout=log_f,
stderr=subprocess.STDOUT,
)
run_state.status = "running"
run_state.start_time = datetime.now()
try:
# Start subprocess
run_state.process = subprocess.Popen(
cmd,
env=env,
cwd=str(self.project_root),
stdout=log_f,
stderr=subprocess.STDOUT,
)
run_state.status = "running"
run_state.start_time = datetime.now()
except Exception:
log_f.close()
raise
console.print(
f"[dim] ▶️ Run {run_state.run_id} started (PID: {run_state.process.pid}, "