-
Notifications
You must be signed in to change notification settings - Fork 1
feat(device manager): add device dependency resolution #686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
5798e5d to
3fe92e5
Compare
|
@cappel89 this would be ready for testing if you want. |
29f6b98 to
d3e7a9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces device dependency resolution through a new "needs" field in device configurations. Dependencies are resolved using Kahn's algorithm for topological sorting, ensuring devices are initialized in the correct order and that subsequent device operations respect this ordering.
Key Changes:
- Added "needs" field to device model for specifying dependencies
- Implemented dependency resolution with cyclic dependency detection
- Applied dependency ordering to all device operations (read, stage, trigger, etc.)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| bec_server/bec_server/device_server/devices/devicemanager.py | Implements dependency resolution algorithm, device ordering map, and get_device_order method |
| bec_server/bec_server/device_server/devices/config_update_handler.py | Adds update_session_config method and integrates dependency validation into config update flow |
| bec_server/bec_server/device_server/device_server.py | Applies device ordering to all device operations (trigger, complete, pre_scan, read, stage, unstage) |
| bec_lib/bec_lib/atlas_models.py | Adds "needs" field to device model with VARIANT hash inclusion |
| bec_lib/bec_lib/config_helper.py | Documents the new "needs" field with usage examples |
| bec_server/tests/tests_device_server/test_device_manager_ds.py | Adds comprehensive tests for dependency resolution, cyclic dependency detection, and device ordering |
| bec_lib/tests/test_device_hashing.py | Updates device hashing tests to include "needs" field in test fixtures and expected outputs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d3e7a9a to
75f77b1
Compare
75f77b1 to
fab188f
Compare
This PR introduces a dependency resolution for device actions. Dependencies between devices can now be specified through an additional field in the device config:
needs. These dependencies will not only sort the initialization but also any subsequent request to multiple devices will respect the sorting.Please note that
needscreates a strong coupling between devices. Disabling a "needed" device will therefore also lead to other devices being invalid. If the device resolution detects a dependency on a disabled device, a warning will be raised.closes #687