-
Notifications
You must be signed in to change notification settings - Fork 10
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
add the docs to make a new device #579
add the docs to make a new device #579
Conversation
b7ae8df
to
a2dd6c3
Compare
the tests are failing because of an ophyd-async issue |
46ea122
to
3b84edb
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.
I like the idea, but I'm not sure flowcharts are the best format for this. Read my other comments and see what you think.
flowchart TD | ||
highLevelStart([Start]) --> scoutUsers[Scout current and potential users of the device, tag them in the draft PR] | ||
scoutUsers --> testPVs[Test PVs to get the right values] | ||
testPVs --> decideStateEnums[Decide on State Enums: extend str, Enum] | ||
decideStateEnums --> chooseMethods[Choose which superclass methods to override] | ||
chooseMethods --> finalizeDevice[Finalize Device Implementation] | ||
finalizeDevice --> requestFeedback[Request feedback from tagged users] | ||
requestFeedback --> rebaseOnMain[Rebase on main -> make sure tests pass still] | ||
rebaseOnMain --> coordinateMerges[Coordinate merges with other codebase updates] | ||
coordinateMerges --> markPRReady[Mark PR as ready] |
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.
Could: I'm actually not sure this works very well as a flowchart for the following reasons:
- It prescribes an arbitrary order in which to do things, who says I should test the PVs before coming up with enum values? The other way around is actually easier using the dodal CLI.
- It implies you should do each step once and never again. In reality making a device is nothing like that, it is an iterative process. The dodal CLI makes it easy to constantly test the PVs as you write signals, rather than once upfront. You also don't come up with a list of enums upfront, you work through one signal at a time and when you discover one that needs to be an enum, you write it and decide on enum values for that signal only, rinse and repeat.
- It takes up a lot of page-space to convey comparatively little information.
I think what we want here is a worked example, rather than a precise series of steps. Perhaps a paragraph explaining in prose about testing the PVs, making enum signals, raising draft PRs etc. and then an example device with all of those things?
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.
I agree with Callum, I think a worked example would be better
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.
It takes up a lot of page-space to convey comparatively little information.
1 I got this based on #480 experiences where defining enum values before testing the right PVs was counterproductive. I'm happy to change this into a command from dodal cli, I didn't know this existed
2 then we can change it for there to be an iterative process. we can put what you just wrote.
page-space is free and it's not like we're printing this. empty space is the key to clear design.
re 'worked example': it's personal preference, it's fair that some people prefer prose modality to a diagram or the other way around, I think for inclusiveness we should support both.
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.
I would argue they are fundamentally different. My suggestion is a rough guide to help you figure out the sequence of steps you need to take. The current flowchart provides a precise sequence of steps, which I think is too prescriptive.
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.
Of the 3 flowcharts, only one has branching while the others are a strict linear progression. I agree that those make more sense as a worked example.
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.
@callumforrester pls what would be a good prose exmple here?
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.
This but with more words/detail:
"Familiarise yourself with the basics of ophyd-async devices , some considerations you should make while developing are , see example below. You are advised to gather requirements early, raise draft PRs, seek feedback, make use of the CLI to test. You should try to consolidate similar devices, the tests give you confidence that they will still work if you change them
".
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.
The current flowchart provides a precise sequence of steps, which I think is too prescriptive.
this is just a guide and of course every user will need to adapt this. word-by-word maybe less than 5% of devices would have gone through this process in this step order.
I don't see this as 'the order' to do things, just 'an order of things to base your investigations on that roughly should work if your use case is the average one'.
and I'm not sure how many more words/detail you see fit, this is very vague to me maybe I am not the best person to write out the prose part.
testStart([Start Testing]) --> createFixtures[Create fixtures for various states of the device] | ||
createFixtures --> createMockReactions[Create mock reactions to signals] | ||
createMockReactions --> testStateTransitions[Test each device state transition] | ||
testStateTransitions --> testAgainstHardware[Test against hardware] | ||
testAgainstHardware --> testingComplete[Testing Complete] |
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.
Ditto to my other comment, I would prefer examples to flowcharts
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.
Could: Extra things that I think should also go in here:
- The objective is to get it into
main
and then test it on the beamline! Ensuring fast iteration. You write the device, you assume you know how it works, you write tests against those assumptions, you merge. Then and only then do you test your assumptions on the beamline. If they were wrong, that's more issues. - See if you can find a similar device that someone has already made. If one seems to exists but has different PV names, those can and should be changed. Advise consulting with controls. If the device is urgently needed, two copies can coexist but there must be an issue to reconcile.
- There's some of this already but more general advise not to do this task alone. Consult before starting, seek feedback early (e.g. draft PR) and merge with other people's devices where possible. The test suite should provide the confidence to do so without breaking anything.
|
||
This high-level flowchart guides the overall process of creating a new ophyd_async device, from testing PVs to overriding methods and determining state enums. | ||
|
||
```{mermaid} |
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.
```{mermaid} | |
```mermaid |
Should get this to render?
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.
idk, for me it renders in vscode preview
|
||
This flowchart assists in selecting the appropriate interfaces based on the device's capabilities, such as file writing, reading values from process variables (PVs), and mobility within scans. | ||
|
||
```{mermaid} |
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.
```{mermaid} | |
```mermaid |
|
||
This flowchart outlines the testing procedure for the new ophyd_async device, from creating fixtures to testing state transitions and hardware integration. | ||
|
||
```{mermaid} |
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.
```{mermaid} | |
```mermaid |
flowchart TD | ||
highLevelStart([Start]) --> scoutUsers[Scout current and potential users of the device, tag them in the draft PR] | ||
scoutUsers --> testPVs[Test PVs to get the right values] | ||
testPVs --> decideStateEnums[Decide on State Enums: extend str, Enum] | ||
decideStateEnums --> chooseMethods[Choose which superclass methods to override] | ||
chooseMethods --> finalizeDevice[Finalize Device Implementation] | ||
finalizeDevice --> requestFeedback[Request feedback from tagged users] | ||
requestFeedback --> rebaseOnMain[Rebase on main -> make sure tests pass still] | ||
rebaseOnMain --> coordinateMerges[Coordinate merges with other codebase updates] | ||
coordinateMerges --> markPRReady[Mark PR as ready] |
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.
Of the 3 flowcharts, only one has branching while the others are a strict linear progression. I agree that those make more sense as a worked example.
8057efc
to
ced0a10
Compare
e90f489
to
55d69fa
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #579 +/- ##
==========================================
+ Coverage 93.03% 93.69% +0.66%
==========================================
Files 103 104 +1
Lines 3903 3967 +64
==========================================
+ Hits 3631 3717 +86
+ Misses 272 250 -22 ☔ View full report in Codecov by Sentry. |
ab23442
to
bab8edd
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.
There's no worked examples in this repository of how to produce a device. I think it makes a lot of sense to defer that to existing ophyd-async docs (& docs).
Some of the process of writing a device should then be captured there (enum validation, testing PVs) , and then this can be simplified to "when to create/not create a new device", "how to write a good issue that captures requirements" and "how to properly test a device".
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.
I still think that this would be better as a worked example but it's a reasonable start
bab8edd
to
86b1348
Compare
86b1348
to
f133119
Compare
Fixes #578
Instructions to reviewer on how to test:
Checks for reviewer
dodal connect ${BEAMLINE}