Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #102 +/- ##
==========================================
+ Coverage 87.75% 87.84% +0.09%
==========================================
Files 31 33 +2
Lines 1347 1456 +109
==========================================
+ Hits 1182 1279 +97
- Misses 165 177 +12 ☔ View full report in Codecov by Sentry. |
cf9160c to
5327339
Compare
e21f785 to
cdaf83a
Compare
|
Wrong Gar(r)y tagged in the PR description @evalott100 ? |
Hopefully, I'm too on holiday to give a review |
|
Very mad that you replied Garry!! |
Apologies this is what I get for tying |
Yes we do. The user wants to see the text label and doesn't care if the device gets sent the label or the index. |
This confuses me, the phoebus screen will be updating the IOC values (which would have an mbb record which takes indices or string), which will update the record through What would need to change is where we make the attribute.
This would have the exact same behaviour across the stack so long as we change FastCS/src/fastcs/transport/epics/gui.py Lines 67 to 72 in cdaf83a so that strings with allowed values also make
|
+1
I did try this at some point in a stale branch and it worked fine so we could keep all this logic inside fastcs-odin, though would be nice if it was resolved higher up. I'm not sure if Odin is unusual in how it handles enums though I suspect there are other potential use cases that would expect ints. (odin-control's ParameterTree doesn't actually properly implemented string labels for enums in its own allowed_values/metadata currently so I was manually adding in these labels for testing, I want to rework that at some point anyway, maybe this should be more of an Odin change) |
I agree. My initial approach was to add a It might clean things up if we added a One solutionUpstream, we could have something like: match datatype:
case Enum(enum_cls):
datatype.add_cast_to(
SOME_EPICS_BACKEND_HASHABLE_IDENTIFIER,
lambda enum: enum.value
)
datatype.add_cast_from(
SOME_EPICS_BACKEND_HASHABLE_IDENTIFIER,
lambda value: enum_cls(value)
)Then FastCS/src/fastcs/transport/epics/ioc.py Lines 247 to 248 in cdaf83a becomes async def async_write_display(value: T):
record.set(attribute.datatype.cast_to(SOME_EPICS_BACKEND_HASHABLE_IDENTIFIER, value), process=False) and FastCS/src/fastcs/transport/epics/ioc.py Lines 244 to 245 in cdaf83a becomes Then downstream you could add_cast_from(
SOME_HTTP_ODIN_BACKEND_HASHABLE_IDENTIFIER,
lambda value: enum_cls(value)
)Since the http client in odin implements it's own updater I'm unsure if it's a good idea though. |
|
Could we do waveform in a separate PR? I have some comments on that, but I think we could get that in it quickly whereas there is a lot to discuss on enums. |
08aba7f to
4dd37af
Compare
00f6389 to
fd7df19
Compare
|
@evalott100 we have merged #98 - could you resolve the conflicts? I would like to get this in next. |
337bc8e to
379f006
Compare
0e3064e to
a77cf47
Compare
This is needed since not all datatypes are supported on every backend.
In both `EPICS` and `Tango`, now the index of the `Enum` member will be used instead of the `value`. The labels will always be the enum member `name`.
a77cf47 to
a20aefe
Compare
a20aefe to
1138a80
Compare
I won't be adding these to GraphQL in the same PR.
I'd like a quick review before I add tests for the remaining uncovered areas since it'll probably change around. @garryod @marcelldls