Closed tjgalvin closed 4 weeks ago
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.
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.