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

Fix bug flushing Data frames from asyncio client #56

Merged
merged 2 commits into from
Sep 4, 2023
Merged

Conversation

coretl
Copy link
Contributor

@coretl coretl commented Sep 1, 2023

When AsyncioClient.data() was called with non-zero flush_period then it only yielded the Data after flush when a new packet of data appeared on the wire or at the end of acquisition. This changes it to be more eager and yield as soon as it is flushed.

@codecov
Copy link

codecov bot commented Sep 1, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03% 🎉

Comparison is base (e24fdfc) 96.37% compared to head (4ebc66a) 96.41%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage   96.37%   96.41%   +0.03%     
==========================================
  Files          12       12              
  Lines        1160     1198      +38     
==========================================
+ Hits         1118     1155      +37     
- Misses         42       43       +1     
Files Changed Coverage Δ
pandablocks/asyncio.py 97.87% <100.00%> (-0.19%) ⬇️

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

When AsyncioClient.data() was called with non-zero flush_period
then it only yielded the Data after flush when a new packet of data
appeared on the wire or at the end of acquisition. This changes it to be
more eager and yield as soon as it is flushed.
@dmgav
Copy link
Contributor

dmgav commented Sep 1, 2023

@coretl I just tested the code with PandABox and PandA IOC. Panda was configured to generate 12 trigger pulses, which resulted in 12 data points saved to HDF5 file. So this seems to fix the original issue. But now I see the following error message (IOC remains functional):

INFO:Arming PandA
INFO:Opened '/nsls2/users/dgavrilov/panda-test/panda_data_20230901_110824.h5' with 16 byte samples stored in 3 datasets
INFO:Requested number of frames (12) captured, disabling Capture.
INFO:Closed '/nsls2/users/dgavrilov/panda-test/panda_data_20230901_110824.h5' after writing 12 samples. End reason is 'Ok'
ERROR:_GatheringFuture exception was never retrieved
future: <_GatheringFuture finished exception=CancelledError()>
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/conda_envs/2023-2.1-py310-tiled-panda/lib/python3.10/asyncio/tasks.py", line 605, in sleep
    return await future
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

asyncio.exceptions.CancelledError
INFO:Disarming PandA

@coretl
Copy link
Contributor Author

coretl commented Sep 1, 2023

@dmgav does this work for you now? Should I merge?

@dmgav
Copy link
Contributor

dmgav commented Sep 1, 2023

Yes, position capture works now without issues.

@coretl coretl merged commit 3e086c9 into master Sep 4, 2023
10 checks passed
@coretl coretl deleted the asyncio-flushing branch September 4, 2023 08:05
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