stability
This commit is contained in:
34
main.py
34
main.py
@ -65,16 +65,27 @@ async def run_web_dashboard():
|
||||
except Exception as e:
|
||||
logger.warning(f"[WARNING] Real-time streaming failed: {e}")
|
||||
|
||||
# Verify data connection
|
||||
# Verify data connection with retry mechanism
|
||||
logger.info("[DATA] Verifying live data connection...")
|
||||
symbol = config.get('symbols', ['ETH/USDT'])[0]
|
||||
test_df = data_provider.get_historical_data(symbol, '1m', limit=10)
|
||||
if test_df is not None and len(test_df) > 0:
|
||||
logger.info("[SUCCESS] Data connection verified")
|
||||
logger.info(f"[SUCCESS] Fetched {len(test_df)} candles for validation")
|
||||
else:
|
||||
logger.error("[ERROR] Data connection failed - no live data available")
|
||||
return
|
||||
|
||||
# Wait for data provider to initialize and fetch initial data
|
||||
max_retries = 10
|
||||
retry_delay = 2
|
||||
|
||||
for attempt in range(max_retries):
|
||||
test_df = data_provider.get_historical_data(symbol, '1m', limit=10)
|
||||
if test_df is not None and len(test_df) > 0:
|
||||
logger.info("[SUCCESS] Data connection verified")
|
||||
logger.info(f"[SUCCESS] Fetched {len(test_df)} candles for validation")
|
||||
break
|
||||
else:
|
||||
if attempt < max_retries - 1:
|
||||
logger.info(f"[DATA] Waiting for data provider to initialize... (attempt {attempt + 1}/{max_retries})")
|
||||
await asyncio.sleep(retry_delay)
|
||||
else:
|
||||
logger.warning("[WARNING] Data connection verification failed, but continuing with system startup")
|
||||
logger.warning("The system will attempt to fetch data as needed during operation")
|
||||
|
||||
# Load model registry for integrated pipeline
|
||||
try:
|
||||
@ -122,6 +133,7 @@ async def run_web_dashboard():
|
||||
logger.info("Starting training loop...")
|
||||
|
||||
# Start the training loop
|
||||
logger.info("About to start training loop...")
|
||||
await start_training_loop(orchestrator, trading_executor)
|
||||
|
||||
except Exception as e:
|
||||
@ -207,6 +219,8 @@ async def start_training_loop(orchestrator, trading_executor):
|
||||
logger.info("STARTING ENHANCED TRAINING LOOP WITH COB INTEGRATION")
|
||||
logger.info("=" * 70)
|
||||
|
||||
logger.info("Training loop function entered successfully")
|
||||
|
||||
# Initialize checkpoint management for training loop
|
||||
checkpoint_manager = get_checkpoint_manager()
|
||||
training_integration = get_training_integration()
|
||||
@ -222,8 +236,10 @@ async def start_training_loop(orchestrator, trading_executor):
|
||||
|
||||
try:
|
||||
# Start real-time processing (Basic orchestrator doesn't have this method)
|
||||
logger.info("Checking for real-time processing capabilities...")
|
||||
try:
|
||||
if hasattr(orchestrator, 'start_realtime_processing'):
|
||||
logger.info("Starting real-time processing...")
|
||||
await orchestrator.start_realtime_processing()
|
||||
logger.info("Real-time processing started")
|
||||
else:
|
||||
@ -231,6 +247,8 @@ async def start_training_loop(orchestrator, trading_executor):
|
||||
except Exception as e:
|
||||
logger.warning(f"Real-time processing not available: {e}")
|
||||
|
||||
logger.info("About to enter main training loop...")
|
||||
|
||||
# Main training loop
|
||||
iteration = 0
|
||||
while True:
|
||||
|
Reference in New Issue
Block a user