In an effort to nicely handle potential use of SLURM $MEMDIR and $LOCALDIR type local storage mechanisms I have attempted to spec out a couple context managers to help out.
The idea being that on entry to the context the necessarily files are copied over to the compute node local storage space while creating folders along the way, work is performed (e.g. wsclean on the local copy), and output files are copied back.
There are two managers:
temporarily_move_into: a subject directory or file is temporarily copied over to a temporary folder, work is performed, and it is copied back. The subject is the only item intended to be moved back, other files created along the way may not be.
hold_then_move_into: a folder if created where anything inside of it at the end of the context manager is copied over to the final directory.
Very much a toy at this point, but tests in tests/test_utils.py seem to mock up the expected behaviour with the use cases I have in mind. Likely can be evolved, e.g. add some extra files to place into hold_then_move_into on that folders creation.
In an effort to nicely handle potential use of SLURM
$MEMDIR
and$LOCALDIR
type local storage mechanisms I have attempted to spec out a couple context managers to help out.The idea being that on entry to the context the necessarily files are copied over to the compute node local storage space while creating folders along the way, work is performed (e.g. wsclean on the local copy), and output files are copied back.
There are two managers:
temporarily_move_into
: a subject directory or file is temporarily copied over to a temporary folder, work is performed, and it is copied back. The subject is the only item intended to be moved back, other files created along the way may not be.hold_then_move_into
: a folder if created where anything inside of it at the end of the context manager is copied over to the final directory.Very much a toy at this point, but tests in
tests/test_utils.py
seem to mock up the expected behaviour with the use cases I have in mind. Likely can be evolved, e.g. add some extra files to place intohold_then_move_into
on that folders creation.