Skip to content

Commit

Permalink
WIP: Temporarily disable local file deletion in runner
Browse files Browse the repository at this point in the history
skipci
  • Loading branch information
cortadocodes committed Jul 10, 2024
1 parent e67a30a commit e350960
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions octue/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,32 +453,32 @@ def _finalise_and_clean_up(self, analysis, save_diagnostics):
if save_diagnostics == SAVE_DIAGNOSTICS_ON:
self.diagnostics.upload()

if self.delete_local_files:
# Delete temporary directories first as this will delete entire downloaded datasets.
if temporary_directories:
logger.warning(
"Deleting registered temporary directories created during analysis. This is not thread-safe - set "
"`delete_local_files=False` at instantiation of `Runner` to switch this off."
)

for dir in temporary_directories:
logger.debug("Deleting temporary directory at %r.", dir.name)
dir.cleanup()

# Then delete any datafiles were downloaded separately from a dataset.
if downloaded_files:
logger.warning(
"Deleting datafiles downloaded during analysis. This is not thread-safe - set "
"`delete_local_files=False` at instantiation of `Runner` to switch this off."
)

for path in downloaded_files:
if not os.path.exists(path):
continue

logger.debug("Deleting downloaded file at %r.", path)

try:
os.remove(path)
except FileNotFoundError:
logger.debug("Couldn't delete %r - it was already deleted.", path)
# if self.delete_local_files:
# # Delete temporary directories first as this will delete entire downloaded datasets.
# if temporary_directories:
# logger.warning(
# "Deleting registered temporary directories created during analysis. This is not thread-safe - set "
# "`delete_local_files=False` at instantiation of `Runner` to switch this off."
# )
#
# for dir in temporary_directories:
# logger.debug("Deleting temporary directory at %r.", dir.name)
# dir.cleanup()
#
# # Then delete any datafiles were downloaded separately from a dataset.
# if downloaded_files:
# logger.warning(
# "Deleting datafiles downloaded during analysis. This is not thread-safe - set "
# "`delete_local_files=False` at instantiation of `Runner` to switch this off."
# )
#
# for path in downloaded_files:
# if not os.path.exists(path):
# continue
#
# logger.debug("Deleting downloaded file at %r.", path)
#
# try:
# os.remove(path)
# except FileNotFoundError:
# logger.debug("Couldn't delete %r - it was already deleted.", path)

0 comments on commit e350960

Please sign in to comment.