fix: Add get_factor_count() to QuantTrace to prevent parallel run crashes

Problem:
- All 50 parallel runs failed with: AttributeError: 'QuantTrace' object has no attribute 'get_factor_count'
- The _build_strategies_with_ai() method calls self.trace.get_factor_count()
- This method didn't exist in the QuantTrace class

Fix:
- Add get_factor_count() method to QuantTrace class
- Add increment_factor_count() method to track factor generation
- Call increment_factor_count() in running() step when factors are generated
- _build_strategies_with_ai() is already wrapped in try/except for safety

Now the parallel runs will work correctly.
This commit is contained in:
TPTBusiness
2026-04-06 10:52:28 +02:00
parent e1ebd35754
commit 51aebefe7a
3 changed files with 87 additions and 7 deletions
+4
View File
@@ -192,6 +192,10 @@ class QuantRDLoop(RDLoop):
logger.error(f"Factor extraction failed.")
raise FactorEmptyError("Factor extraction failed.")
# Increment factor count for tracking
if hasattr(self, 'trace') and hasattr(self.trace, 'increment_factor_count'):
self.trace.increment_factor_count()
# Handle failed experiments gracefully (don't break the loop)
if getattr(exp, "failed", False):
reason = getattr(exp, "failure_reason", "unknown")