From 2bb2f38c167a1fbbdc905bbff956b342e200e1f1 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 22 Nov 2022 11:49:04 -0600 Subject: [PATCH 1/6] bugfix + minor tweaks to dandi upload --- element_interface/dandi.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/element_interface/dandi.py b/element_interface/dandi.py index 2c2a2f5..afec038 100644 --- a/element_interface/dandi.py +++ b/element_interface/dandi.py @@ -35,11 +35,13 @@ def upload_to_dandi( working_directory, str(dandiset_id) ) # enforce str - download( - f"https://gui-staging.dandiarchive.org/#/dandiset/{dandiset_id}" - if staging - else dandiset_id, - output_dir=working_directory, + + dandiset_url = f"https://gui-staging.dandiarchive.org/#/dandiset/{dandiset_id}" if staging else f"https://dandiarchive.org/dandiset/{dandiset_id}/draft" + + download(dandiset_url, output_dir=working_directory) + + subprocess.run( + ["nwbinspector", dandiset_directory, "--config", "dandi", "--report-file-path", os.path.join(dandiset_directory, 'nwbinspector.txt')], shell=True ) subprocess.run( @@ -57,8 +59,7 @@ def upload_to_dandi( ) upload( - [dandiset_directory], - # dandiset_path=dandiset_directory, # dandi.upload has no such arg + paths=[dandiset_directory], dandi_instance="dandi-staging" if staging else "dandi", sync=sync, ) From f72f037efeba67b59ec97bf4bd193a7968e6c768 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Wed, 18 Jan 2023 10:07:38 -0600 Subject: [PATCH 2/6] add kwarg `existing` in dandi `upload` --- element_interface/dandi.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/element_interface/dandi.py b/element_interface/dandi.py index afec038..341f426 100644 --- a/element_interface/dandi.py +++ b/element_interface/dandi.py @@ -11,6 +11,7 @@ def upload_to_dandi( working_directory: str = None, api_key: str = None, sync: bool = False, + existing: str = "refresh", ): """Upload NWB files to DANDI Archive @@ -24,6 +25,7 @@ def upload_to_dandi( environmental variable DANDI_API_KEY sync (str, optional): If True, delete all files in archive that are not present in the local directory. + existing (str, optional): see full description from `dandi upload --help` """ working_directory = working_directory or os.path.curdir @@ -40,9 +42,9 @@ def upload_to_dandi( download(dandiset_url, output_dir=working_directory) - subprocess.run( - ["nwbinspector", dandiset_directory, "--config", "dandi", "--report-file-path", os.path.join(dandiset_directory, 'nwbinspector.txt')], shell=True - ) + # subprocess.run( + # ["nwbinspector", data_directory, "--config", "dandi", "--report-file-path", os.path.join(data_directory, 'nwbinspector.txt')], shell=True + # ) subprocess.run( ["dandi", "organize", "-d", dandiset_directory, data_directory, "-f", "dry"], @@ -61,5 +63,6 @@ def upload_to_dandi( upload( paths=[dandiset_directory], dandi_instance="dandi-staging" if staging else "dandi", + existing=existing, sync=sync, ) From 9b2a1d0a14b457643a994d87cf7359b169e58f9b Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Wed, 3 May 2023 11:56:35 -0500 Subject: [PATCH 3/6] Update dandi.py --- element_interface/dandi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/element_interface/dandi.py b/element_interface/dandi.py index 7f58388..84c4ca2 100644 --- a/element_interface/dandi.py +++ b/element_interface/dandi.py @@ -41,7 +41,10 @@ def upload_to_dandi( dandiset_url = f"https://gui-staging.dandiarchive.org/#/dandiset/{dandiset_id}" if staging else f"https://dandiarchive.org/dandiset/{dandiset_id}/draft" - download(dandiset_url, output_dir=working_directory) + subprocess.run( + ["dandi", "download", "--download", "dandiset.yaml", "-o", working_directory, dandiset_url], + shell=True, + ) # subprocess.run( # ["nwbinspector", data_directory, "--config", "dandi", "--report-file-path", os.path.join(data_directory, 'nwbinspector.txt')], shell=True @@ -56,9 +59,8 @@ def upload_to_dandi( ["dandi", "organize", "-d", dandiset_directory, data_directory], shell=True ) - print( - f"work_dir: {working_directory}\ndata_dir: {data_directory}\n" - + f"dand_dir: {dandiset_directory}" + subprocess.run( + ["dandi", "validate", dandiset_directory], shell=True ) upload( From a77a9f3fceb96cdf7e512fcc63258f8bcbd3da29 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Wed, 2 Aug 2023 10:54:03 -0500 Subject: [PATCH 4/6] Update dandi.py --- element_interface/dandi.py | 1 - 1 file changed, 1 deletion(-) diff --git a/element_interface/dandi.py b/element_interface/dandi.py index 84c4ca2..b946ea5 100644 --- a/element_interface/dandi.py +++ b/element_interface/dandi.py @@ -38,7 +38,6 @@ def upload_to_dandi( working_directory, str(dandiset_id) ) # enforce str - dandiset_url = f"https://gui-staging.dandiarchive.org/#/dandiset/{dandiset_id}" if staging else f"https://dandiarchive.org/dandiset/{dandiset_id}/draft" subprocess.run( From 00e41fa17ddf74580cff9032ab9bdf6442cefdb3 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Wed, 2 Aug 2023 11:21:28 -0500 Subject: [PATCH 5/6] Update element_interface/dandi.py Co-authored-by: Kabilar Gunalan --- element_interface/dandi.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/element_interface/dandi.py b/element_interface/dandi.py index b946ea5..01553f4 100644 --- a/element_interface/dandi.py +++ b/element_interface/dandi.py @@ -45,10 +45,6 @@ def upload_to_dandi( shell=True, ) - # subprocess.run( - # ["nwbinspector", data_directory, "--config", "dandi", "--report-file-path", os.path.join(data_directory, 'nwbinspector.txt')], shell=True - # ) - subprocess.run( ["dandi", "organize", "-d", dandiset_directory, data_directory, "-f", "dry"], shell=True, # without this param, subprocess interprets first arg as file/dir From 9e23c3f2544570a9aa865bb2654bc962e9122c12 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Wed, 2 Aug 2023 13:10:16 -0500 Subject: [PATCH 6/6] update CHANGELOG, version --- CHANGELOG.md | 6 ++++++ element_interface/version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7293361..b7dfd0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. + +## [0.6.1] - 2023-08-02 + ++ Update DANDI upload funtionality to improve useability + + ## [0.6.0] - 2023-07-26 + Update - `prairieviewreader.py` -> `prairie_view_loader.py` diff --git a/element_interface/version.py b/element_interface/version.py index 6d90ece..0da8726 100644 --- a/element_interface/version.py +++ b/element_interface/version.py @@ -1,3 +1,3 @@ """Package metadata""" -__version__ = "0.6.0" +__version__ = "0.6.1"