Files
rpa_vision_v3/demo_system_cleanup.py
Dom a27b74cf22 v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- Frontend v4 accessible sur réseau local (192.168.1.40)
- Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard)
- Ollama GPU fonctionnel
- Self-healing interactif
- Dashboard confiance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:23:51 +01:00

77 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""
Démonstration du système de cleanup
Montre comment le système nettoie proprement toutes les ressources.
"""
import logging
import sys
import time
from pathlib import Path
# Add current directory to path for imports
sys.path.insert(0, str(Path(__file__).parent))
from core.system import initialize_system_cleanup, shutdown_system
def main():
"""Démonstration du cleanup système."""
print("🎯 RPA Vision V3 - System Cleanup Demo")
print("=" * 50)
# Configuration du logging pour voir les détails
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
print("1. Initializing system with cleanup...")
initialize_system_cleanup()
print("\n2. System is now running with automatic cleanup...")
print(" - Memory managers registered")
print(" - GPU resource managers registered")
print(" - Analytics system registered")
print(" - Signal handlers installed")
print("\n3. Simulating some work...")
# Simuler du travail avec les systèmes
try:
from core.execution.memory_cache import get_memory_manager
from core.gpu.gpu_resource_manager import get_gpu_resource_manager
# Utiliser le memory manager
memory_manager = get_memory_manager(enable_monitoring=False)
print(f" ✓ Memory manager active: {memory_manager.max_memory_mb}MB limit")
# Utiliser le GPU manager
gpu_manager = get_gpu_resource_manager()
status = gpu_manager.get_status()
print(f" ✓ GPU manager active: {status.execution_mode} mode")
# Simuler du travail
time.sleep(1)
except Exception as e:
print(f" ⚠ Some systems not available: {e}")
print("\n4. Testing cleanup (Ctrl+C to trigger signal cleanup)...")
print(" Press Ctrl+C to see signal-based cleanup in action")
print(" Or wait 5 seconds for programmatic cleanup...")
try:
time.sleep(5)
print("\n5. Triggering programmatic cleanup...")
shutdown_system()
except KeyboardInterrupt:
print("\n5. Signal received! Triggering cleanup...")
shutdown_system()
print("\n✅ Cleanup demo completed!")
print("All resources have been properly cleaned up.")
if __name__ == "__main__":
main()