Conversation
- Added orchestration module for managing simulation tasks, including queuing and worker management. - Introduced SimulationOrchestrator class to handle task submissions and completions. - Implemented SimulationTask and SimulationWorker classes for task representation and execution. - Enhanced caching mechanisms for simulation results. - Updated requirements.txt with necessary dependencies for orchestration and simulation. - Created setup_env.sh script for easy environment setup and package installation. - Added comprehensive tests for the new orchestration features, including configuration loading, simulation requests, and task management.
…ctured logging - Added centralized YAML configuration system - Implemented simulation orchestration with priority queues - Added intelligent hash-based caching with multiple storage formats - Created REST API with FastAPI for simulation management - Added structured logging with JSON output - Maintained full backward compatibility with legacy code - Added comprehensive test suite for new architecture - Updated requirements.txt with all necessary dependencies - Created setup script for environment management Ready for integration of: - Web GUI for monitoring - Parameter optimization engines - Model Context Protocol (MCP) server
- Implemented settings page for managing PLECS configuration, cache settings, orchestration settings, and web GUI settings. - Added functionality for saving and resetting settings with user feedback. - Created simulations page for managing and monitoring PLECS simulations, including filtering, pagination, and detailed views. - Developed modals for creating new simulations and viewing simulation details. - Integrated API calls for loading simulations and handling simulation actions (start, cancel, download results). - Added a test script for validating the web GUI endpoints and functionality.
…ve options and logging
- Created a new smoke test suite in tests/test_smoke.py to validate core module imports and basic functionality. - Added default configuration file tools/config/default.yml with PLECS executable paths. - Implemented logging for the Windows installer in tools/installer_windows.log and status tracking in tools/installer_windows_status.json. - Updated the Windows installer scripts to include better error handling and logging. - Removed outdated macOS installer script tools/installers/macos_installer.sh and Windows installer script tools/installers/windows_installer.bat. - Enhanced the PowerShell installer to run smoke tests after installation and log results.
- Implemented a lightweight PLECS file parser in `plecs_parser.py` to extract component blocks and initialization commands. - Added functions to parse parameters and create an overview of PLECS files. - Enhanced `PlecsApp` to improve executable path resolution with fallback options. - Developed an end-to-end CLI test suite in `test_end_to_end_cli.py` to validate the complete simulation workflow. - Created unit tests for the parser in `test_parser.py` and simulation management in `test_simulation.py`. - Added debugging tools for parsing initialization commands and running sample PLECS files.
test: update test paths for PLECS file parser tests
- Implemented test suite for cache behavior with file changes and simulation type isolation in `test_cache_behavior.py`. - Created simple integration tests for real PLECS functionality in `test_plecs_integration_simple.py`. - Developed extensive integration tests for XML-RPC functionality in `test_plecs_xmlrpc_integration.py`. - Added comprehensive tests for real PLECS integration, parameter sweeps, and cache verification in `test_real_plecs_integration.py`. - Ensured tests cover scenarios for simulation execution, parameter modifications, and file change detection. - Verified cache behavior for identical and different parameters, ensuring correct isolation by simulation type.
…nce SimulationCache functionality tests: add comprehensive tests for cache behavior and real PLECS integration
…s and error handling
… parser functionality
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive test infrastructure and web interface templates for the PyPLECS simulation framework. The changes establish a complete testing strategy with automated, interactive, and GUI automation tests, while providing a modern web interface for managing simulations.
Key changes:
- Comprehensive test suite reorganization with specialized test files for different testing scenarios
- Complete web GUI templates for dashboard, simulations, cache management, and settings
- Development tools and scripts for parser testing and debugging
- Windows installer with PowerShell automation for streamlined setup
Reviewed Changes
Copilot reviewed 66 out of 79 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
tools/run_parse_sample.py |
Debug script for testing PLECS parser functionality |
tools/debug_parse_init.py |
Advanced debugging tool for PLECS initialization command parsing |
tools/installers/windows_installer.ps1 |
Comprehensive PowerShell installer with Python download, verification, and PLECS detection |
tools/installers/USAGE_WINDOWS.md |
Documentation for Windows installer usage and CI integration |
tests/ (multiple files) |
Complete test suite with automated, interactive, and GUI automation test categories |
templates/ (multiple files) |
Modern responsive web interface templates for simulation management |
Comments suppressed due to low confidence (1)
tests/test_real_plecs_integration.py:12
- Import statement appears before sys.path manipulation which could cause import failures. The sys.path.append should be moved before the pyplecs imports.
import pytest
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -0,0 +1,7 @@ | |||
| import sys | |||
| sys.path.insert(0, 'D:/git/pyplecs') | |||
There was a problem hiding this comment.
Hardcoded absolute path should be replaced with a relative path or environment variable to make the script portable across different development environments.
| sys.path.insert(0, 'D:/git/pyplecs') | |
| import os | |
| # Use environment variable or relative path for pyplecs | |
| pyplecs_path = os.environ.get('PYPLECS_PATH') | |
| if not pyplecs_path: | |
| # Default to ../pyplecs relative to this script | |
| script_dir = os.path.dirname(os.path.abspath(__file__)) | |
| pyplecs_path = os.path.abspath(os.path.join(script_dir, '..', 'pyplecs')) | |
| sys.path.insert(0, pyplecs_path) |
| @@ -0,0 +1,26 @@ | |||
| import sys | |||
| sys.path.insert(0, 'D:/git/pyplecs') | |||
There was a problem hiding this comment.
Hardcoded absolute path should be replaced with a relative path or environment variable to make the script portable across different development environments.
| sys.path.insert(0, 'D:/git/pyplecs') | |
| import os | |
| sys.path.insert(0, os.environ.get('PYPLECS_PATH', os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'pyplecs')))) |
|
|
||
| if ($Checksum) { | ||
| $actual = Get-FileSHA256 -Path $installer | ||
| if ($actual -ne $Checksum.ToLower()) { Log "Checksum mismatch: expected $Checksum got $actual"; $global:ExitCode = 3; $global:StatusMessage = 'checksum_mismatch'; Write-StatusJson $global:ExitCode $global:StatusMessage; exit $global:ExitCode } |
There was a problem hiding this comment.
[nitpick] Long conditional statement should be broken into multiple lines for better readability and maintainability.
| if ($actual -ne $Checksum.ToLower()) { Log "Checksum mismatch: expected $Checksum got $actual"; $global:ExitCode = 3; $global:StatusMessage = 'checksum_mismatch'; Write-StatusJson $global:ExitCode $global:StatusMessage; exit $global:ExitCode } | |
| if ($actual -ne $Checksum.ToLower()) { | |
| Log "Checksum mismatch: expected $Checksum got $actual" | |
| $global:ExitCode = 3 | |
| $global:StatusMessage = 'checksum_mismatch' | |
| Write-StatusJson $global:ExitCode $global:StatusMessage | |
| exit $global:ExitCode | |
| } |
| if (-not $SkipAuthSignatureCheck) { | ||
| $sigOk = Verify-AuthenticodeSignature -Path $installer | ||
| if ($sigOk) { Log "Authenticode signature valid" } else { Log "Authenticode signature invalid or not present"; if (-not $SkipAuthSignatureCheck) { $global:ExitCode = 4; $global:StatusMessage = 'auth_signature_invalid'; Write-StatusJson $global:ExitCode $global:StatusMessage; exit $global:ExitCode } } | ||
| } |
There was a problem hiding this comment.
[nitpick] Complex conditional logic with nested if statements should be refactored into separate functions or broken into multiple lines for better readability.
| } | |
| if ($sigOk) { | |
| Log "Authenticode signature valid" | |
| } else { | |
| Log "Authenticode signature invalid or not present" | |
| if (-not $SkipAuthSignatureCheck) { | |
| $global:ExitCode = 4 | |
| $global:StatusMessage = 'auth_signature_invalid' | |
| Write-StatusJson $global:ExitCode $global:StatusMessage | |
| exit $global:ExitCode | |
| } | |
| } | |
| } |
|
|
||
|
|
||
| def _sample_model_path(): | ||
| # Usa sempre il path assoluto del modello di test |
There was a problem hiding this comment.
Comment is in Italian instead of English. Should be translated to maintain consistency with the rest of the codebase.
| # Usa sempre il path assoluto del modello di test | |
| # Always use the absolute path of the test model |
| # Add parent directory to path for imports | ||
| sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) | ||
|
|
||
| from pyplecs.plecs_parser import parse_plecs_file |
There was a problem hiding this comment.
Import statement appears before sys.path manipulation which could cause import failures. The sys.path.insert should be moved before the pyplecs imports.
| import shutil | ||
| from pathlib import Path | ||
| from pyplecs.cache import SimulationCache | ||
| from cli_demo_nomocks import RealPlecsSimulator |
There was a problem hiding this comment.
Import from 'cli_demo_nomocks' suggests this is importing from a demo/example file rather than the main codebase, which could cause issues if the demo file is moved or renamed.
| from cli_demo_nomocks import RealPlecsSimulator | |
| from pyplecs.simulator import RealPlecsSimulator |
| {% endblock %} | ||
|
|
||
| {% block extra_js %} | ||
| <script> |
There was a problem hiding this comment.
[nitpick] Large JavaScript block in HTML template should be moved to a separate .js file for better maintainability and caching.
| {% endblock %} | ||
|
|
||
| {% block extra_js %} | ||
| <script> |
There was a problem hiding this comment.
[nitpick] Large JavaScript block in HTML template should be moved to a separate .js file for better maintainability and caching.
No description provided.