cluster4npu/cluster4npu_ui/test_deploy.py
Masonmason efc09b8bb1 Add comprehensive pipeline deployment system with UI integration
Major Features:
• Complete deployment dialog system with validation and dongle management
• Enhanced dashboard with deploy button and validation checks
• Comprehensive deployment test suite and demo scripts
• Pipeline validation for model paths, firmware, and port configurations
• Real-time deployment status tracking and error handling

Technical Improvements:
• Node property validation for deployment readiness
• File existence checks for models and firmware files
• Port ID validation and format checking
• Integration between UI components and core deployment functions
• Comprehensive error messaging and user feedback

New Components:
• DeploymentDialog with advanced configuration options
• Pipeline deployment validation system
• Test deployment scripts with various scenarios
• Enhanced dashboard UI with deployment workflow
• Screenshot updates reflecting new deployment features

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 00:24:24 +08:00

104 lines
3.3 KiB
Python

#!/usr/bin/env python3
"""
Test script for pipeline deployment functionality.
This script demonstrates the deploy feature without requiring actual dongles.
"""
import sys
import os
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt
# Add the current directory to path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from ui.dialogs.deployment import DeploymentDialog
def test_deployment_dialog():
"""Test the deployment dialog with sample pipeline data."""
# Sample pipeline data (similar to what would be exported from the UI)
sample_pipeline_data = {
"project_name": "Test Fire Detection Pipeline",
"description": "A test pipeline for demonstrating deployment functionality",
"nodes": [
{
"id": "input_001",
"name": "Camera Input",
"type": "ExactInputNode",
"pos": [100, 200],
"properties": {
"source_type": "Camera",
"device_id": 0,
"resolution": "1920x1080",
"fps": 30,
"source_path": ""
}
},
{
"id": "model_001",
"name": "Fire Detection Model",
"type": "ExactModelNode",
"pos": [300, 200],
"properties": {
"model_path": "./models/fire_detection.nef",
"scpu_fw_path": "./firmware/fw_scpu.bin",
"ncpu_fw_path": "./firmware/fw_ncpu.bin",
"dongle_series": "520",
"num_dongles": 1,
"port_id": "28"
}
},
{
"id": "output_001",
"name": "Detection Output",
"type": "ExactOutputNode",
"pos": [500, 200],
"properties": {
"output_type": "Stream",
"format": "JSON",
"destination": "tcp://localhost:5555",
"save_interval": 1.0
}
}
],
"connections": [
{
"output_node": "input_001",
"output_port": "output",
"input_node": "model_001",
"input_port": "input"
},
{
"output_node": "model_001",
"output_port": "output",
"input_node": "output_001",
"input_port": "input"
}
],
"version": "1.0"
}
app = QApplication(sys.argv)
# Enable high DPI support
app.setAttribute(Qt.AA_EnableHighDpiScaling, True)
app.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
# Create and show deployment dialog
dialog = DeploymentDialog(sample_pipeline_data)
dialog.show()
print("Deployment dialog opened!")
print("You can:")
print("1. Click 'Analyze Pipeline' to see topology analysis")
print("2. Review the configuration in different tabs")
print("3. Click 'Deploy to Dongles' to test deployment process")
print("(Note: Actual dongle deployment will fail without hardware)")
# Run the application
return app.exec_()
if __name__ == "__main__":
sys.exit(test_deployment_dialog())