-
Notifications
You must be signed in to change notification settings - Fork 8
feat!: Redesign BlueapiClient for use in scripts #1323
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
Additional details and impacted files@@ Coverage Diff @@
## main #1323 +/- ##
==========================================
+ Coverage 95.00% 95.29% +0.28%
==========================================
Files 42 42
Lines 2765 2909 +144
==========================================
+ Hits 2627 2772 +145
+ Misses 138 137 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Some initial thoughts without having looked into it too much:
|
|
Thanks for looking at it. You're right, it needs a lot more docs but I wanted to wait to check the interface was vaguely right before writing it up. I'll add something to the PR for now.
The The
Not a bad idea but all the |
|
This requires #1315 |
a52db61 to
763a49c
Compare
|
Should interrupting a plan abort the plan on the server? |
olliesilvester
left a comment
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.
Was there an outcome for this PR after the demo last week? Personally I think it's best to just merge and get people to use it and get feedback that way.
I agree with the comments about docs. I think a simple quickstart guide for making a script and for starting in interactive mode would be fine to start with. Ideally a BL scientist can use the client given that their beamline already has BlueAPI running
|
I think that was pretty much the decision. The other PR to add type-checking would be useful but can be a later PR. I will rebase this one and add the cancel-plan-on-interrupt change but then I think it can go in. The sooner it gets used in anger the problems can be found. It is a breaking change though so I don't know what we do about versioning |
Allows autocomplete to work when working in a REPL
* Support args as well as kwargs when running plans * Get child devices via attributes on parent devices * Make more methods into properties
For some reason pyright can't figure out what the return type is otherwise and you don't get completion.
It broke type checking
Where previously the BlueapiClient was mostly a thin wrapper around the
BlueapiRestClient, it is now a more standalone class intended to be
usable from other scripts/applications as well as interactive sessions.
The client can now be created from just the path to a config file
without the user having to handle parsing.
Plans can now be run with less boilerplate with a more method-like
interface. Available devices can be queried and then used as if they
were local objects when running plans.
Using the new client
This client can then be reused to run plans or query devices.
Sub-devices can also be accessed, while checking that the sub-device
exists on the server:
Available plans can be accessed from the server and treated
(approximately) like local methods. Calling a plan as a method blocks
while the plan is running
Other client methods have been replaced by (cached) properties:
While running in an interactive session, plans and devices are
auto-completable if the REPL supports it.