Repository navigation
Connections - #459
Draft
tomkane-dls wants to merge 48 commits into
Draft
Connections#459tomkane-dls wants to merge 48 commits into
tomkane-dls wants to merge 48 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #459 +/- ##
==========================================
+ Coverage 91.37% 91.85% +0.48%
==========================================
Files 72 75 +3
Lines 2922 3034 +112
==========================================
+ Hits 2670 2787 +117
+ Misses 252 247 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ark_disconnected()
tomkane-dls
force-pushed
the
connections
branch
from
November 16, 2026 13:20
451845e to
976ffb9
Compare
…ver connection and controller intialisation over to the runner
…utes and subcontrollers being added after
… make them more easily subclassable
…he user tries to set the introspection themselves
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Basic connections
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connections - Closes #458
example ioc - > fastcs-thorlabs-mff
Questions
Design: open questions
depends_on(not implemented).depends_onis currently declared at class level, by connection type. A dependent therefore waits for every connection of that type, e.g. each meta writer waits for both Odins. A per-instancedepends_on("conn")in fastcs.yaml, naming the connection, would override the class-level types. It would also fix the case of two parents of the same type.RealConnection | SimConnection)IPConnection | SerialConnection._connection_hintdoesn't recognise a union as a connection, so launch treats the argument as the controller's options argument. This is unchanged from current behaviour, but it isn't defined.connect()orintrospect()actually queries the device. FastCS then cycles down → up → down and never uses upreconnect_attempts. Should the built-in connections, or the docs, require a check that the device itself answers?introspect()result is compared with the original to detect whether the device changed. Leaf types aren't compared, so a parameter that changes type isn't caught. Devices that describe their types as strings would need those strings compared.@disconnect_onnever sees their errors and they never mark the connection down. Not designed yet.Design: known gaps (accepted for now)
@disconnect_onmethods are.Design: decisions
connect()andintrospect()may call its own@disconnect_onmethods. Only the reconnecting task may do this; other callers stay blocked. This is also enforced with a ContextVar.<parent>_<name>, e.g.odin_meta.X | None.ControllerSpeckeeps typed arguments and takes connection instances. Launch and discovery build connections throughConnectionSpec. We chose this over full symmetry, where everything would go through specs.ControllerSpec(PR 4) get their names by binding them to the controller's signature. Anything passed through*argsfalls back to its class name.Reconnect defaults
Reconnect settings per class:
reconnect_attemptsreconnect_perioddisconnect_after_timeoutsConnectionNoneNoneIPConnectionHTTPConnectionSerialConnectiondisconnect_after_timeoutsis the number of consecutive timeouts before the connection is marked down. It defaults to 1 on the base class and must be at least 1.The first reconnect attempt is immediate.
reconnect_periodonly applies between failed attempts.While a scan method is failing, it retries after 1 s, whatever its configured period.
Connection defaults
IPConnection:terminator="\r\n",encoding="utf-8",timeout=5.0,limit=2**16(the limit doesn't count the terminator).SerialConnection:baud=115200, 8 data bits, no parity, 1 stop bit, no flow control,terminator="\r\n",encoding="utf-8",timeout=5.0,limit=2**16. The port is opened exclusively.HTTPConnection:timeout=5.0,verify=True,follow_redirects=True. Itsconnect()sendsGET ""and treats any response as "reachable", even an error status.Eiger example
connections.py
controllers.py
__main__.py
fastcs.yaml
Without fastcs.yaml
The same thing built in Python. A
ControllerSpectakes connection instances, named by their argument.odin_metais left out, so it's discovered: