Skip to content

Commit

Permalink
Merge branch 'main' into front-end-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rhit-zhangam authored Oct 13, 2023
2 parents c4a99af + 2866c9d commit 15a8ff3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def close_experiment_run(expId: DocumentId, expRef: "typing.Any | None"):
syslogger.warning(f'No experiment ref supplied when closing {expId} , could not update it to finished')
close_experiment_logger()
upload_experiment_log(expId)

remove_downloaded_directory(expId)

"""
Determines if the type of the experiment. Accepted types are:
Expand Down Expand Up @@ -286,6 +286,22 @@ def download_experiment_files(experiment: ExperimentData):
return filepath


def remove_downloaded_directory(experimentId: DocumentId):

folder_name = experimentId
target_directory = "ExperimentFiles"
folder_path = f'{target_directory}/{ folder_name}'
explogger.info("this is the path " + folder_path)
explogger.info("Does the path exist? " + str(os.path.exists(folder_path)))
items = os.listdir(target_directory)

try:
shutil.rmtree(folder_path)
explogger.info("The folder directory " + folder_path + " successfully deleted.")
except FileNotFoundError as err:
explogger.error('Error during plot generation')
explogger.exception(err)

"""
Uploads the experiment files
TODO: replace firebase with MongoDB
Expand Down

0 comments on commit 15a8ff3

Please sign in to comment.