Skip to content

Commit

Permalink
Swap staging out order to ensure that output files are moved
Browse files Browse the repository at this point in the history
Apparently I'm losing some jobs to missing input files (unclear how this
is happening...), so better to ensure that the output files are staged
out first before we try cleaning up the input files
  • Loading branch information
raymondEhlers committed Jun 21, 2024
1 parent cdfbe25 commit 8bce173
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mammoth/job_file_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,12 @@ def __exit__(
) -> None:
"""Exiting the context manager, staging out files if appropriate."""
if self.file_stager:
# First, clean up the staged in files so we don't forget.
self._clean_up_staged_in_files_after_task()
# And stage out, using the provided output files if appropriate.
# First, stage out the output files, using the provided output files if appropriate.
# NOTE: We want to do this before the cleanup since we're more worried
# about keeping the output files than cleaning up the input files.
self.file_stager.stage_files_out(files_to_stage_out=self._output_files)
# Next, clean up the staged in files so we don't forget.
self._clean_up_staged_in_files_after_task()
# And then the last bit of cleanup - removing the node work dir itself
try:
self.file_stager.settings.node_work_dir.rmdir()
Expand Down

0 comments on commit 8bce173

Please sign in to comment.