From 42453278ddb2fd6a2fcfd334097240421365acbe Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Wed, 28 Feb 2024 16:25:37 -0800 Subject: [PATCH] Add option to set DANDI_CACHE environment variable to "ignore" (#623) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> --- pyflask/manageNeuroconv/manage_neuroconv.py | 12 ++++++++++++ schemas/json/dandi/upload.json | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index a47a94db9..26432a513 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -582,11 +582,17 @@ def upload_folder_to_dandi( cleanup: Optional[bool] = None, number_of_jobs: Optional[int] = None, number_of_threads: Optional[int] = None, + ignore_cache: bool = False, ): from neuroconv.tools.data_transfers import automatic_dandi_upload os.environ["DANDI_API_KEY"] = api_key # Update API Key + if ignore_cache: + os.environ["DANDI_CACHE"] = "ignore" + else: + os.environ["DANDI_CACHE"] = "" + return automatic_dandi_upload( dandiset_id=dandiset_id, nwb_folder_path=Path(nwb_folder_path), @@ -605,6 +611,7 @@ def upload_project_to_dandi( cleanup: Optional[bool] = None, number_of_jobs: Optional[int] = None, number_of_threads: Optional[int] = None, + ignore_cache: bool = False, ): from neuroconv.tools.data_transfers import automatic_dandi_upload @@ -612,6 +619,11 @@ def upload_project_to_dandi( os.environ["DANDI_API_KEY"] = api_key # Update API Key + if ignore_cache: + os.environ["DANDI_CACHE"] = "ignore" + else: + os.environ["DANDI_CACHE"] = "" + return automatic_dandi_upload( dandiset_id=dandiset_id, nwb_folder_path=CONVERSION_SAVE_FOLDER_PATH / project, # Scope valid DANDI upload paths to GUIDE projects diff --git a/schemas/json/dandi/upload.json b/schemas/json/dandi/upload.json index ced194f5e..6c1e60811 100644 --- a/schemas/json/dandi/upload.json +++ b/schemas/json/dandi/upload.json @@ -20,9 +20,15 @@ "min": 1, "default": 1 }, + "ignore_cache": { + "type": "boolean", + "description": "Ignore the cache used by DANDI to speed up repeated operations.", + "default": false + }, "cleanup": { "type": "boolean", - "title": "Delete Local Files After Upload", + "title": "Cleanup Local Filesystem", + "description": "Delete local files after upload", "default": false } }