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 memdir context manager #115

Closed
tjgalvin opened this issue Jun 18, 2024 · 1 comment
Closed

Add a memdir context manager #115

tjgalvin opened this issue Jun 18, 2024 · 1 comment

Comments

@tjgalvin
Copy link
Owner

In some cases it would be beneficial to copy a measurement set into the local scratch / in-memory directory for some tasks. I can see this being annoying to always code in and out for some functions.

Likely the better thing to do would be to set up a context manager that on entry copies the folder, and on exits returns the folder. If no in-memory / local scratch is required this manager would just return the path as is.

A similar thing can be set up for temporary directories that can accept new files (say wsclean outputs), and anything that exists as the context manager exists is copied to the final location.

@tjgalvin
Copy link
Owner Author

Added something in #118 to get the ball rolling here. In time there might be an additional arg to hold_then_move_into to allow other files / folders to be placed in. Such functionality might merge the need of these two context managers.

I should also look at using the tempfile module instead as well. All in time I suppose.

Closing for now until i better understand how I want to use these in practice.

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

No branches or pull requests

1 participant