Skip to content

Feat/commissioning pre rf#220

Draft
lisazacarias wants to merge 53 commits intoslaclab:mainfrom
lisazacarias:feat/commissioning-pre-rf
Draft

Feat/commissioning pre rf#220
lisazacarias wants to merge 53 commits intoslaclab:mainfrom
lisazacarias:feat/commissioning-pre-rf

Conversation

@lisazacarias
Copy link
Copy Markdown
Collaborator

No description provided.

- CommissioningDatabase class with SQLite backend
- Context manager for safe connection handling
- Schema with JSON columns for nested data structures
- Indexes on cavity_name, cryomodule, status, and phase
- Auto-commit on success, rollback on error
- save_record() for creating and updating records
- get_record() for retrieval by database ID
- Full serialization/deserialization of all data structures
- JSON encoding for complex nested objects
- Proper handling of Optional fields
- get_record_by_cavity() for resume capability
- get_records_by_cryomodule() for batch queries
- get_active_records() for finding interrupted sessions
- delete_record() for cleanup
- get_database_stats() for monitoring
- All queries leverage indexes for performance
- Test suite for database initialization
- Test save/retrieve operations
- Test query methods (by cavity, cryomodule, active status)
- Test delete and statistics
- Test transaction handling (commit/rollback)
- All tests use temporary databases for isolation
- Test serialization of all phase-specific data structures
- Test phase status and checkpoint persistence
- Test complete workflow end-to-end persistence
- Test resume capability after interruption
- Verify all data survives round-trip to database
- Add CommissioningDatabase to module exports
- Update __all__ with all public classes
- Organize exports by category (enums, data, database)
Add abstract base class for commissioning phases with:
- PhaseBase ABC defining common interface for all phases
- PhaseContext for passing execution context
- PhaseStepResult for structured step results
- PhaseResult enum for step outcomes (success/retry/failed/skip)
- Retry logic with configurable max attempts (default 3)
- Checkpoint creation for phase history tracking
- Abort handling for graceful termination
- Exception handling with automatic checkpoint creation

The base class provides the execution framework that will be
used by all concrete phase implementations (cold landing,
SSA characterization, etc.).

Key features:
- Abstract methods enforce consistent interface
- Built-in retry logic with customizable attempts
- Automatic phase status tracking in CommissioningRecord
- Checkpoint creation for audit trail
- Graceful abort support via PhaseContext
…tions

- Change PhaseStatus.COMPLETED to PhaseStatus.COMPLETE in tests
- Update _execute_step_with_retry to mark phase as FAILED when:
  - A step returns PhaseResult.FAILED
  - A step exceeds max retries

This ensures phase_status is correctly updated when steps fail,
not just when exceptions are raised.
…tion

- Add CommissioningPiezo class extending base Piezo with test-specific PVs
- Implement PiezoPreRFPhase using existing PhaseBase architecture
- Add comprehensive test suite (28/29 tests passing)
- Integrate with CommissioningRecord for result persistence
- Support dry-run mode for safe testing
- Add proper checkpoint tracking and error handling

New components:
- commissioning_piezo.py: Hardware extension for commissioning
- phases/piezo_pre_rf.py: Phase implementation
- tests/phases/test_piezo_pre_rf.py: Full test coverage

Phase executes EPICS pre-RF checkout script and validates both piezo
channels pass, recording capacitance values for diagnostics.

Part of RF commissioning application architecture.
- Call finalize_phase on abort, failure, and exception
- Handle both int/string enum values in piezo tests
- Improve test status validation and simulation
Add display panel for cavity piezo pre-RF testing with:
- Live PV monitoring (status, capacitance, equipment state)
- Database integration for test results and session management
- Resume capability for interrupted tests
- Database viewer for commissioning history
…phase workflow support

BREAKING CHANGE: Major architectural refactoring of RF commissioning application

- Reorganize codebase into models/, phases/, ui/, and controllers/ packages
- Move CommissioningPiezo, data models, and database to models/ subdirectory
- Move phase execution logic to dedicated phases/ package
- Create UI components in ui/ subdirectory with builder pattern
- Add session manager for multi-phase commissioning coordination
- Implement phase ordering validation and sequential workflow enforcement
- Add database browser dialog for loading previous commissioning records
- Create multi-phase container display with tabbed interface
- Add comprehensive workflow documentation (PHASE_WORKFLOW.md, COMPLETE_WORKFLOW_EXAMPLE.md)
- Update all import paths to reflect new package structure
- Extend CommissioningPhase enum with get_phase_order(), get_next_phase(), get_previous_phase()
- Add can_start_phase() and advance_to_next_phase() methods to CommissioningRecord
- Implement PhaseDisplayBase abstract class for consistent UI interface
- Add progress callback support in PhaseContext for real-time UI updates
- Enhance PiezoPreRFDisplay with separate PV (EPICS) and local result displays
- Add 100+ new tests for phase ordering, advancement validation, and UI binding
- Fix tuner service simulation failure mode handling (enum to int conversion)

This refactoring separates concerns, improves testability, and enables support
for the complete 7-phase commissioning workflow from PIEZO_PRE_RF through COMPLETE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant