Skip to content

Commit

Permalink
allow keep input folder during job cleanup (#199)
Browse files Browse the repository at this point in the history
As suggested in the PR, we set JOB_CLEANUP_KEEP_INPUT = True as the default setting.
This changes the default behavior.
  • Loading branch information
vieting authored Jul 18, 2024
1 parent ce5f7a2 commit a22e923
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion sisyphus/global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ def file_caching(path):
JOB_CLEANER_INTERVAL = 60
#: How many threads should be cleaning in parallel
JOB_CLEANER_WORKER = 5
#: If the job internal work directory should be keeped re deleted during clean up
#: If the job internal work directory should be kept or deleted during clean up
JOB_CLEANUP_KEEP_WORK = False
#: If the job internal input directory with symlinks to input jobs should be kept or deleted during clean up
JOB_CLEANUP_KEEP_INPUT = True
#: Default value for job used by tk.cleaner to determine if a job should be removed or not
JOB_DEFAULT_KEEP_VALUE = 50
#: How many threads should update the graph in parallel, useful if the filesystem has a high latency
Expand Down
9 changes: 4 additions & 5 deletions sisyphus/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,10 @@ def _sis_cleanup(self):
try:
if not gs.JOB_CLEANUP_KEEP_WORK:
shutil.rmtree(os.path.abspath(self._sis_path(gs.JOB_WORK_DIR)))
files = [
i
for i in os.listdir(self._sis_path())
if i not in (gs.JOB_OUTPUT, gs.JOB_INFO, gs.JOB_WORK_DIR)
]
files_keep = [gs.JOB_OUTPUT, gs.JOB_INFO, gs.JOB_WORK_DIR]
if gs.JOB_CLEANUP_KEEP_INPUT:
files_keep.append(gs.JOB_INPUT)
files = [i for i in os.listdir(self._sis_path()) if i not in files_keep]
subprocess.check_call(
["tar", "-czf", gs.JOB_FINISHED_ARCHIVE] + files, cwd=os.path.abspath(self._sis_path())
)
Expand Down

0 comments on commit a22e923

Please sign in to comment.