mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-09 21:10:56 +00:00
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:
@@ -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")
|
||||
|
||||
@@ -16,6 +16,15 @@ from rdagent.utils.agent.tpl import T
|
||||
class QuantTrace(Trace):
|
||||
def __init__(self, scen: Scenario) -> None:
|
||||
super().__init__(scen)
|
||||
self._factor_count = 0
|
||||
|
||||
def get_factor_count(self) -> int:
|
||||
"""Return the number of factors generated so far."""
|
||||
return self._factor_count
|
||||
|
||||
def increment_factor_count(self) -> None:
|
||||
"""Increment the factor count."""
|
||||
self._factor_count += 1
|
||||
# Initialize the controller with default weights
|
||||
self.controller = EnvController()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user