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 a context manager for AvailableData #70

Conversation

aliddell
Copy link
Member

No description provided.

@aliddell aliddell linked an issue Aug 16, 2023 that may be closed by this pull request
src/runtime.rs Outdated
consumed_bytes as _,
)
.ok()
.expect("Unexpected failure: Was the CoreRuntime NULL?");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.expect("Unexpected failure: Was the CoreRuntime NULL?");
.expect("Unexpected failure");

@aliddell aliddell marked this pull request as ready for review August 16, 2023 17:13
@nclack
Copy link
Member

nclack commented Aug 21, 2023

My main concern with making AvailableData a context manager is that the api still admits the old behavior - possibly leaking the reference. We can make that impossible by creating a separate context manager object and ensuring it's __enter__ function is the sole factory for AvailableData.

…. Move RawAvailableData drop behavior into AvailableData.__exit__.
@aliddell aliddell requested a review from nclack August 22, 2023 20:36
@aliddell aliddell marked this pull request as draft August 22, 2023 20:37
@andy-sweet
Copy link
Contributor

andy-sweet commented Aug 23, 2023

Quickly tested this while trying to reproduce/debug the build issue and found an issue when using the napari plugin to generate 100 frames for 1 simulated camera.

The issue is that I don't get a layer or see any frames. I also get the following warning message in napari.

/Users/asweet/software/miniconda3/envs/acquire-dev/lib/python3.10/site-packages/superqt/utils/_qthreading.py:185: RuntimeWarning: RuntimeError in aborted thread: generator raised StopIteration!

Seems to work OK on main.

See this gist for the full log.

@aliddell aliddell closed this Dec 12, 2023
aliddell added a commit that referenced this pull request Dec 13, 2023
closes #68

This is an alternative to #70.

This is in draft until I feel more confident about the tests and the
napari plugin. But I think it's close.

---------

Co-authored-by: Alan Liddell <[email protected]>
Co-authored-by: Alan Liddell <[email protected]>
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.

AvailableData relies on deletion for cleanup
3 participants