Skip to content

Commit

Permalink
Fix path of data to remove
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusStrobl committed Apr 26, 2024
1 parent 1223ee7 commit 0d71c98
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions processes/result_remover.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def __init__(self, processor_def):
super().__init__(processor_def, PROCESS_METADATA)

def execute(self, data):
logging.info(f"Entered remove data")
mimetype = 'application/json'

try:
Expand Down Expand Up @@ -167,7 +168,7 @@ def __remove_folder(folder_list, folder_location, removed_list, not_removed_list
"""
for i in folder_list:
try:
shutil.rmtree(i)
shutil.rmtree(f'{secrets["GEOAPI_PATH"]}/{folder_location}/{i}')
logging.info(f'Removed {folder_location} folder {i}')
removed_list.append(i)
except Exception as e:
Expand All @@ -185,7 +186,7 @@ def __remove_db_entry(entry_list, removed_list, not_removed_list, error_list):

for i in entry_list:
try:
os.remove(f'{secrets["DATA_PATH"]}/tinydb/{i}')
os.remove(f'{secrets["GEOAPI_PATH"]}/tinydb/{i}')
removed_list.append(i)
not_removed_list.append(i)
except Exception as e:
Expand All @@ -194,8 +195,8 @@ def __remove_db_entry(entry_list, removed_list, not_removed_list, error_list):

return removed_list, not_removed_list, error_list

removed, not_removed, error = __remove_folder(input_folders, 'input', removed, not_removed, error)
removed, not_removed, error = __remove_folder(output_folders, 'output', removed, not_removed, error)
removed, not_removed, error = __remove_folder(input_folders, 'in', removed, not_removed, error)
removed, not_removed, error = __remove_folder(output_folders, 'out', removed, not_removed, error)
removed, not_removed, error = __remove_db_entry(job_list, removed, not_removed, error)

outputs = {
Expand Down

0 comments on commit 0d71c98

Please sign in to comment.