#!/usr/bin/env python3 """ Check complete execution log content """ import sqlite3 import sys from pathlib import Path # Add project root to path project_root = Path(__file__).parent sys.path.insert(0, str(project_root)) def check_logs(): """Check execution logs with complete information.""" db_path = project_root / "data" / "scriptsmanager.db" if not db_path.exists(): print(f"Database not found: {db_path}") return try: conn = sqlite3.connect(str(db_path)) cursor = conn.cursor() # Get all columns from execution_logs cursor.execute("PRAGMA table_info(execution_logs)") columns = cursor.fetchall() print("=== EXECUTION_LOGS TABLE STRUCTURE ===") for col in columns: print(f"Column: {col[1]} ({col[2]})") print() # Get recent execution logs with all data cursor.execute( """ SELECT id, script_id, status, start_time, end_time, exit_code, output, error_output, command_executed, conda_environment, working_directory, process_id, port_allocated FROM execution_logs ORDER BY start_time DESC LIMIT 5 """ ) logs = cursor.fetchall() if not logs: print("No execution logs found") return for log in logs: print(f"=== LOG ID: {log[0]} ===") print(f"Script ID: {log[1]}") print(f"Status: {log[2]}") print(f"Started: {log[3]}") print(f"Ended: {log[4]}") print(f"Exit Code: {log[5]}") print(f"Output Length: {len(log[6]) if log[6] else 0}") print(f"Output: {log[6][:200] if log[6] else 'EMPTY'}") print(f"Error Length: {len(log[7]) if log[7] else 0}") print(f"Error: {log[7][:200] if log[7] else 'EMPTY'}") print(f"Command: {log[8]}") print(f"Conda Env: {log[9]}") print(f"Working Dir: {log[10]}") print(f"Process ID: {log[11]}") print(f"Port: {log[12]}") print("-" * 50) except Exception as e: print(f"Error: {e}") finally: if "conn" in locals(): conn.close() if __name__ == "__main__": check_logs()