Files
gogo2/debug_dashboard.py
2025-09-02 17:59:12 +03:00

57 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""
Cross-Platform Debug Dashboard Script
Kills existing processes and starts the dashboard for debugging on both Linux and Windows.
"""
import subprocess
import sys
import time
import logging
import platform
# Setup logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
def main():
logger.info("=== Cross-Platform Debug Dashboard Startup ===")
logger.info(f"Platform: {platform.system()} {platform.release()}")
# Step 1: Kill existing processes
logger.info("Step 1: Cleaning up existing processes...")
try:
result = subprocess.run([sys.executable, 'kill_dashboard.py'],
capture_output=True, text=True, timeout=30)
if result.returncode == 0:
logger.info("✅ Process cleanup completed")
else:
logger.warning("⚠️ Process cleanup had issues")
except subprocess.TimeoutExpired:
logger.warning("⚠️ Process cleanup timed out")
except Exception as e:
logger.error(f"❌ Process cleanup failed: {e}")
# Step 2: Wait a moment
logger.info("Step 2: Waiting for cleanup to settle...")
time.sleep(3)
# Step 3: Start dashboard
logger.info("Step 3: Starting dashboard...")
try:
logger.info("🚀 Starting: python run_clean_dashboard.py")
logger.info("💡 Dashboard will be available at: http://127.0.0.1:8050")
logger.info("💡 API endpoints available at: http://127.0.0.1:8050/api/")
logger.info("💡 Press Ctrl+C to stop")
# Start the dashboard
subprocess.run([sys.executable, 'run_clean_dashboard.py'])
except KeyboardInterrupt:
logger.info("🛑 Dashboard stopped by user")
except Exception as e:
logger.error(f"❌ Dashboard failed to start: {e}")
if __name__ == "__main__":
main()