mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-07 12:07:43 +00:00
fix: Handle Qlib Docker backtest failures gracefully (SECURITY FIX)
- Add _evaluate_factor_directly() to factor_runner.py - When Qlib Docker returns None, try direct evaluation from result.h5 - Compute IC/Sharpe directly from factor values + forward returns - Loop continues instead of hanging on Docker failures - Fix MD5 security warning: usedforsecurity=False in cache_manager.py Files changed: - rdagent/scenarios/qlib/developer/factor_runner.py - rdagent/app/qlib_rd_loop/quant.py - rdagent/scenarios/qlib/local/cache_manager.py
This commit is contained in:
@@ -189,6 +189,18 @@ class QuantRDLoop(RDLoop):
|
||||
if exp is None:
|
||||
logger.error(f"Factor extraction failed.")
|
||||
raise FactorEmptyError("Factor extraction failed.")
|
||||
|
||||
# Handle failed experiments gracefully (don't break the loop)
|
||||
if getattr(exp, "failed", False):
|
||||
reason = getattr(exp, "failure_reason", "unknown")
|
||||
factor_name = "unknown"
|
||||
if hasattr(exp, "hypothesis") and exp.hypothesis is not None:
|
||||
factor_name = getattr(exp.hypothesis, "hypothesis", "unknown")
|
||||
logger.warning(
|
||||
f"Factor '{factor_name}' failed evaluation: {reason}. "
|
||||
f"Continuing with next factor."
|
||||
)
|
||||
# Return exp anyway - loop will continue
|
||||
elif prev_out["direct_exp_gen"]["propose"].action == "model":
|
||||
exp = self.model_runner.develop(prev_out["coding"])
|
||||
logger.log_object(exp, tag="runner result")
|
||||
|
||||
Reference in New Issue
Block a user