From 43bc6bfd948351f01b72f4201baa7e79f142912b Mon Sep 17 00:00:00 2001 From: Aaron R Hall Date: Mon, 9 Dec 2024 13:25:51 -0700 Subject: [PATCH] Correct archives location Follow-up related to issue 877. The archives folder was mentioned in a few additional locations that need to be updated --- beeflow/client/core.py | 1 + beeflow/wf_manager/resources/wf_actions.py | 4 +++- beeflow/wf_manager/resources/wf_list.py | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/beeflow/client/core.py b/beeflow/client/core.py index 27b14660c..229b0c34b 100644 --- a/beeflow/client/core.py +++ b/beeflow/client/core.py @@ -559,6 +559,7 @@ def reset(archive: bool = typer.Option(False, '--archive', '-a', Shutdown beeflow and all BEE components. Delete the bee_workdir directory which results in: Removing the archive of all workflows. + (unless archives is configured elsewhere). Removing the archive of workflow containers (unless container_archive is configured elsewhere). Reset all databases associated with the beeflow app. diff --git a/beeflow/wf_manager/resources/wf_actions.py b/beeflow/wf_manager/resources/wf_actions.py index cc2e57fce..fb978b667 100644 --- a/beeflow/wf_manager/resources/wf_actions.py +++ b/beeflow/wf_manager/resources/wf_actions.py @@ -10,6 +10,7 @@ from beeflow.common.db import wfm_db from beeflow.common.db.bdb import connect_db +from beeflow.common.config_driver import BeeConfig as bc log = bee_logging.setup(__name__) db_path = wf_utils.get_db_path() @@ -77,7 +78,8 @@ def delete(self, wf_id): bee_workdir = wf_utils.get_bee_workdir() workflow_dir = f"{bee_workdir}/workflows/{wf_id}" shutil.rmtree(workflow_dir, ignore_errors=True) - archive_path = f"{bee_workdir}/archives/{wf_id}.tgz" + archive_dir = bc.get('DEFAULT', 'bee_archive_dir') + archive_path = f"{archive_dir}/{wf_id}.tgz" if os.path.exists(archive_path): os.remove(archive_path) return resp diff --git a/beeflow/wf_manager/resources/wf_list.py b/beeflow/wf_manager/resources/wf_list.py index e188bb7ff..48e491167 100644 --- a/beeflow/wf_manager/resources/wf_list.py +++ b/beeflow/wf_manager/resources/wf_list.py @@ -20,6 +20,7 @@ from beeflow.common.db import wfm_db from beeflow.common.db.bdb import connect_db +from beeflow.common.config_driver import BeeConfig as bc log = bee_logging.setup(__name__) @@ -150,9 +151,9 @@ def patch(self): """Copy workflow archive.""" reqparser = reqparse.RequestParser() data = reqparser.parse_args() - bee_workdir = wf_utils.get_bee_workdir() wf_id = data['wf_id'] - archive_path = os.path.join(bee_workdir, 'archives', wf_id + '.tgz') + archive_dir = bc.get('DEFAULT', 'bee_archive_dir') + archive_path = os.path.join(archive_dir, wf_id + '.tgz') with open(archive_path, 'rb') as archive: archive_file = jsonpickle.encode(archive.read()) archive_filename = os.path.basename(archive_path)