Skip to content

Conversation

@wakonig
Copy link
Contributor

@wakonig wakonig commented Dec 7, 2025

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 needs creates 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

@codecov
Copy link

codecov bot commented Dec 7, 2025

Codecov Report

❌ Patch coverage is 91.20879% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../bec_server/device_server/devices/devicemanager.py 89.06% 3 Missing and 4 partials ⚠️
...ver/device_server/devices/config_update_handler.py 94.11% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@wakonig wakonig force-pushed the feature/dev_obj_resolution branch 4 times, most recently from 5798e5d to 3fe92e5 Compare December 11, 2025 16:28
@wakonig
Copy link
Contributor Author

wakonig commented Dec 15, 2025

@cappel89 this would be ready for testing if you want.

@wakonig wakonig force-pushed the feature/dev_obj_resolution branch from 29f6b98 to d3e7a9a Compare December 18, 2025 13:06
@wakonig wakonig marked this pull request as ready for review December 18, 2025 13:28
Copy link
Contributor

Copilot AI left a 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.

@wakonig wakonig marked this pull request as draft December 18, 2025 13:46
@wakonig wakonig marked this pull request as ready for review December 22, 2025 06:19
@wakonig wakonig force-pushed the feature/dev_obj_resolution branch from d3e7a9a to 75f77b1 Compare January 7, 2026 09:57
@wakonig wakonig force-pushed the feature/dev_obj_resolution branch from 75f77b1 to fab188f Compare January 7, 2026 09:59
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.

[FEAT]: Add dependency resolution for device actions on multiple devices

2 participants