Skip to content

Commit

Permalink
Add option to set DANDI_CACHE environment variable to "ignore" (#623)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Cody Baker <[email protected]>
  • Loading branch information
3 people authored Feb 29, 2024
1 parent 472d870 commit 4245327
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -605,13 +611,19 @@ 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

# CONVERSION_SAVE_FOLDER_PATH.mkdir(exist_ok=True, parents=True) # Ensure base directory exists

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
Expand Down
8 changes: 7 additions & 1 deletion schemas/json/dandi/upload.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 4245327

Please sign in to comment.