Skip to content

Conversation

@GDYendell
Copy link
Contributor

@GDYendell GDYendell commented Oct 24, 2025

Summary

  • AttrR.update and AttrR._on_update_callbacks -> AttrR._update_callback
    • Used to create an async task called periodically to update the attribute
  • AttrR.set() -> AttrR.update()
  • AttrW.process() -> AttrW.put(sync_setpoint: bool = False)
    • Transports should call without sync_setpoint
  • AttrR._on_set_callbacks -> AttrR._on_update_callbacks
    • Called when the value in the attribute is updated. This is what transports register with to get the latest value.
    • In an AttrR or AttrRW without an IO, this is left unset so update does nothing.
  • AttrW._process_callbacks -> AttrW._on_put_callback. This is called when a new value is put.
    • Calls send on the IO if it has one
    • In an AttrRW without an IO, the on_put_callback falls back to AttrRW.set so that internal driver parameters work as expected. This replaces the old SimpleHandler in a much simple way.
  • AttrW._write_display_callbacks -> AttrW._sync_setpoint_callbacks
    • Called in put(sync_setpoint=True) to update the setpoint of the attribute being put, e.g. when a driver is manually putting to attributes based on user input such as a fan out
    • Called in AttrRW.update the first time to initialise the setpoints so that they aren't blank

Outstanding Questions

  • Should transports ever call put with sync_setpoint=True? This will update the setpoints of all transports. I think it is useful to not do this so that it is clear when looking at the UI for a transport that the put was from somewhere else.
  • Should fan out attributes call put with sync_setpoint=True? I think yes because it is effectively a user input and the UI should reflect that.
  • Do the callback names make sense? Should on_put just be put, or something else?

@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 93.57798% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.20%. Comparing base (019ae15) to head (1526ecd).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/fastcs/attributes.py 91.66% 6 Missing ⚠️
src/fastcs/launch.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #237      +/-   ##
==========================================
+ Coverage   90.18%   90.20%   +0.01%     
==========================================
  Files          45       45              
  Lines        2273     2276       +3     
==========================================
+ Hits         2050     2053       +3     
  Misses        223      223              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GDYendell GDYendell requested a review from coretl October 24, 2025 15:04
@GDYendell GDYendell force-pushed the attribute-callbacks branch 2 times, most recently from a647981 to aa69868 Compare October 27, 2025 16:05
@GDYendell GDYendell force-pushed the attribute-callbacks branch from aa69868 to 1526ecd Compare October 27, 2025 16:28
@GDYendell GDYendell merged commit 7d9dcb1 into main Oct 27, 2025
12 checks passed
@GDYendell GDYendell deleted the attribute-callbacks branch October 27, 2025 16:57
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.

Rationalise logic of synchronisation between transport, attribute and handler

1 participant