Skip to content
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 FrameReceiver controllers, move FP controllers to odin_data.py #33

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

jsouter
Copy link
Contributor

@jsouter jsouter commented Aug 27, 2024

Addressing #11 (see also odin-detector/odin-data#346), using the generic OdinDataAdapter as the basis for DAQController and DAQAdapterController which are inherited by FrameProcessor(/Receiver)Controller and FrameProcessor(/Receiver)AdapterController.

edit: WIP, can break down further and add a FrameReceiverDecoderController

@jsouter jsouter requested a review from GDYendell August 27, 2024 08:02
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 93.87755% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82.30%. Comparing base (d00e26e) to head (29e7c3a).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/odin_fastcs/odin_controller.py 33.33% 2 Missing ⚠️
src/odin_fastcs/odin_data.py 97.72% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   81.38%   82.30%   +0.91%     
==========================================
  Files          10        9       -1     
  Lines         360      390      +30     
==========================================
+ Hits          293      321      +28     
- Misses         67       69       +2     

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

@jsouter jsouter marked this pull request as draft August 27, 2024 08:08
@jsouter jsouter self-assigned this Aug 27, 2024
Copy link
Contributor

@GDYendell GDYendell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the right sort of thing. I think I am OK with having fp and fr in one file as they are all very small classes.

Could you change DAQ -> OdinData in the class names and move FrameProcessorAdapterController above FrameProcessorController so that they are in hierarchical order?

@jsouter
Copy link
Contributor Author

jsouter commented Aug 27, 2024

This looks like the right sort of thing. I think I am OK with having fp and fr in one file as they are all very small classes.

Could you change DAQ -> OdinData in the class names and move FrameProcessorAdapterController above FrameProcessorController so that they are in hierarchical order?

Have done that, had to overload init as the forward reference needed for _subcontroller_cls needed to be moved into function scope

@jsouter
Copy link
Contributor Author

jsouter commented Aug 27, 2024

Added the decoder sub controller, can add in a few tests if needed.

@GDYendell
Copy link
Contributor

had to overload init as the forward reference needed for _subcontroller_cls needed to be moved into function scope

Ah I didn't think about that. In that case it is not worth it. The AdapterControllers can go after.

@GDYendell
Copy link
Contributor

GDYendell commented Aug 28, 2024

Do we know where this decoder name parameter is coming from? That doesn't appear in the API, so I am not sure why odin-fastcs is creating that.

ERROR:root:Update loop failed for api/0.1/fr/1/status/decoder/name:
name not found in response:
{'response': 'OdinDatatAdapter GET error: Invalid path: 1/status/decoder/name'}

@jsouter
Copy link
Contributor Author

jsouter commented Aug 28, 2024

Do we know where this decoder name parameter is coming from? That doesn't appear in the API, so I am not sure why odin-fastcs is creating that.

ERROR:root:Update loop failed for api/0.1/fr/1/status/decoder/name:
name not found in response:
{'response': 'OdinDatatAdapter GET error: Invalid path: 1/status/decoder/name'}

Will look into it, I know that config/hdf/file/name had to be changed to "prefix" because of some interaction between fastcs and odin that makes "name" an invalid name for a parameter.

edit: EigerFrameDecoder::get_status() (and the dummy decoders) add "name" to the status_msg, will test if either changing that to another key fixes it or if it needs to be formally added to the API somewhere.

@jsouter
Copy link
Contributor Author

jsouter commented Aug 28, 2024

Okay yeah, changing the key to "dummy_name" as a quick test in DummyUDPFrameDecoder makes the signal work properly. I suppose we could either remove the parameter from odin, rename it, or add some logic in odin-fastcs to do special handling of attributes called "name"

@GDYendell
Copy link
Contributor

GDYendell commented Aug 28, 2024

Ah so name is visible when requesting metadata, but not otherwise. That is why it creates the parameter, but then can't read it from the server.

I suggest we rename to type or class, but there is no way to enforce that across all decoders. I think the odin server should error on start up, rather than on requesting the parameter.

@GDYendell
Copy link
Contributor

GDYendell commented Aug 28, 2024

It would be good to add

  • unit tests that create the controllers, pass in some dummy OdinParameters and make sure _process_parameters does the right thing, like test_fp_process_parameters and test_fp_create_plugin_sub_controllers.

  • an introspection test that takes a dumped server response, parses it and makes sure the parameters are as expected. See dump_server_response.py and test_introspection.py.

@jsouter jsouter changed the title Add FrameReceiver controllers, move FP controllers to daq.py Add FrameReceiver controllers, move FP controllers to odin_data.py Aug 29, 2024
@jsouter jsouter requested a review from GDYendell August 29, 2024 13:29
@GDYendell
Copy link
Contributor

Could you squash this into one commit and force push, and mark as ready for review if you are happy with it?

Move FrameProccesor controllers to odin_data.py
@jsouter jsouter marked this pull request as ready for review August 29, 2024 14:00
@GDYendell GDYendell merged commit c2830d5 into main Sep 6, 2024
19 checks passed
@GDYendell GDYendell deleted the fr-dev branch September 6, 2024 11:10
@GDYendell
Copy link
Contributor

Thanks @jsouter !

@GDYendell
Copy link
Contributor

This didn't break things. main is broken because the CI happened to pick up the latest pydantic (2.9.0) on merge.

See pydantic/pydantic#10345 and epics-containers/pvi#137.

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.

2 participants