From 46c41a59d9085ad5aa666be438d851c593b9ad49 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Wed, 28 May 2025 13:58:25 -0500 Subject: [PATCH 1/3] Add superuser name for creation This avoids creating dandisets with invalid metadata, ie contributor name = ", " --- dandi/dandiapi.py | 4 ++++ dandi/tests/fixtures.py | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dandi/dandiapi.py b/dandi/dandiapi.py index 553ec672c..1b64eedb8 100644 --- a/dandi/dandiapi.py +++ b/dandi/dandiapi.py @@ -1106,6 +1106,10 @@ def wait_until_valid(self, max_time: float = 120) -> None: v = self.get_version(self.version_id) if v.status is VersionStatus.VALID and not v.asset_validation_errors: return + # TODO(asmacdo) can we fail fast? + if v.status is VersionStatus.INVALID: + break + sleep(0.5) # TODO: Improve the presentation of the error messages about = { diff --git a/dandi/tests/fixtures.py b/dandi/tests/fixtures.py index d246109ab..08b62ebcd 100644 --- a/dandi/tests/fixtures.py +++ b/dandi/tests/fixtures.py @@ -434,12 +434,16 @@ def docker_compose_setup() -> Iterator[dict[str, str]]: "--rm", "-e", "DJANGO_SUPERUSER_PASSWORD=nsNc48DBiS", + "-e", + "DJANGO_SUPERUSER_EMAIL=admin@nil.nil", + "-e", + "DJANGO_SUPERUSER_FIRST_NAME=Test", + "-e", + "DJANGO_SUPERUSER_LAST_NAME=Admin", "django", "./manage.py", "createsuperuser", "--no-input", - "--email", - "admin@nil.nil", ], cwd=str(LOCAL_DOCKER_DIR), env=env, @@ -578,10 +582,6 @@ def mkdandiset(self, name: str, embargo: bool = False) -> SampleDandiset: { "description": "A test Dandiset", "license": ["spdx:CC0-1.0"], - # The contributor needs to be given explicitly here or else - # it'll be set based on the user account. For the Docker - # Compose setup, that would mean basing it on the admin user, - # whose name doesn't validate under dandischema. "contributor": [ { "schemaKey": "Person", From de13f9fd80ea09695a805d3136d092cca510a1e6 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Wed, 28 May 2025 15:42:24 -0500 Subject: [PATCH 2/3] Update expected metadata to include superuser --- .../tests/data/update_dandiset_from_doi/biorxiv.json | 12 +++++++++++- .../tests/data/update_dandiset_from_doi/elife.json | 12 +++++++++++- .../data/update_dandiset_from_doi/jneurosci.json | 12 +++++++++++- .../tests/data/update_dandiset_from_doi/nature.json | 12 +++++++++++- .../tests/data/update_dandiset_from_doi/neuron.json | 12 +++++++++++- 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.json b/dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.json index 11ca3a46e..61a79dee8 100644 --- a/dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.json +++ b/dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.json @@ -13,11 +13,21 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Aguillon-Rodriguez, Valeria; Angelaki, Dora E.; Bayer, Hannah M.; Bonacchi, Niccol\u00f2; Carandini, Matteo; Cazettes, Fanny; Chapuis, Gaelle A.; Churchland, Anne K.; Dan, Yang; Dewitt, Eric E. J.; Faulkner, Mayo; Forrest, Hamish; Haetzel, Laura M.; Hausser, Michael; Hofer, Sonja B.; Hu, Fei; Khanal, Anup; Krasniak, Christopher S.; Laranjeira, In\u00eas; Mainen, Zachary F.; Meijer, Guido T.; Miska, Nathaniel J.; Mrsic-Flogel, Thomas D.; Murakami, Masayoshi; Noel, Jean-Paul; Pan-Vazquez, Alejandro; Rossant, Cyrille; Sanders, Joshua I.; Socha, Karolina Z.; Terry, Rebecca; Urai, Anne E.; Vergara, Hernando M.; Wells, Miles J.; Wilson, Christian J.; Witten, Ilana B.; Wool, Lauren E.; Zador, Anthony (2023) Standardized and reproducible measurement of decision-making in mice (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000001/draft", + "citation": "Admin, Test; Aguillon-Rodriguez, Valeria; Angelaki, Dora E.; Bayer, Hannah M.; Bonacchi, Niccol\u00f2; Carandini, Matteo; Cazettes, Fanny; Chapuis, Gaelle A.; Churchland, Anne K.; Dan, Yang; Dewitt, Eric E. J.; Faulkner, Mayo; Forrest, Hamish; Haetzel, Laura M.; Hausser, Michael; Hofer, Sonja B.; Hu, Fei; Khanal, Anup; Krasniak, Christopher S.; Laranjeira, In\u00eas; Mainen, Zachary F.; Meijer, Guido T.; Miska, Nathaniel J.; Mrsic-Flogel, Thomas D.; Murakami, Masayoshi; Noel, Jean-Paul; Pan-Vazquez, Alejandro; Rossant, Cyrille; Sanders, Joshua I.; Socha, Karolina Z.; Terry, Rebecca; Urai, Anne E.; Vergara, Hernando M.; Wells, Miles J.; Wilson, Christian J.; Witten, Ilana B.; Wool, Lauren E.; Zador, Anthony (2023) Standardized and reproducible measurement of decision-making in mice (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000001/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000001", "repository": "http://localhost:8085", "contributor": [ + { + "affiliation": [], + "email": "admin@nil.nil", + "includeInCitation": true, + "name": "Admin, Test", + "roleName": [ + "dcite:ContactPerson" + ], + "schemaKey": "Person" + }, { "name": "Tests, DANDI-Cli", "email": "nemo@example.com", diff --git a/dandi/cli/tests/data/update_dandiset_from_doi/elife.json b/dandi/cli/tests/data/update_dandiset_from_doi/elife.json index 6fd685fe2..30c6ebc2f 100644 --- a/dandi/cli/tests/data/update_dandiset_from_doi/elife.json +++ b/dandi/cli/tests/data/update_dandiset_from_doi/elife.json @@ -13,11 +13,21 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Chowdhury, Raeed H; Glaser, Joshua I; Miller, Lee E (2023) Area 2 of primary somatosensory cortex encodes kinematics of the whole arm (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000004/draft", + "citation": "Admin, Test; Chowdhury, Raeed H; Glaser, Joshua I; Miller, Lee E (2023) Area 2 of primary somatosensory cortex encodes kinematics of the whole arm (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000004/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000004", "repository": "http://localhost:8085", "contributor": [ + { + "affiliation": [], + "email": "admin@nil.nil", + "includeInCitation": true, + "name": "Admin, Test", + "roleName": [ + "dcite:ContactPerson" + ], + "schemaKey": "Person" + }, { "name": "Tests, DANDI-Cli", "email": "nemo@example.com", diff --git a/dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.json b/dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.json index 851a7a1e0..7a6402078 100644 --- a/dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.json +++ b/dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.json @@ -13,11 +13,21 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Ito, Makoto; Doya, Kenji (2023) Validation of Decision-Making Models and Analysis of Decision Variables in the Rat Basal Ganglia (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000002/draft", + "citation": "Admin, Test; Ito, Makoto; Doya, Kenji (2023) Validation of Decision-Making Models and Analysis of Decision Variables in the Rat Basal Ganglia (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000002/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000002", "repository": "http://localhost:8085", "contributor": [ + { + "affiliation": [], + "email": "admin@nil.nil", + "includeInCitation": true, + "name": "Admin, Test", + "roleName": [ + "dcite:ContactPerson" + ], + "schemaKey": "Person" + }, { "name": "Tests, DANDI-Cli", "email": "nemo@example.com", diff --git a/dandi/cli/tests/data/update_dandiset_from_doi/nature.json b/dandi/cli/tests/data/update_dandiset_from_doi/nature.json index a13ae61fa..04c6b1aaf 100644 --- a/dandi/cli/tests/data/update_dandiset_from_doi/nature.json +++ b/dandi/cli/tests/data/update_dandiset_from_doi/nature.json @@ -13,11 +13,21 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Sit, Kevin K.; Goard, Michael J. (2023) Coregistration of heading to visual cues in retrosplenial cortex (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000005/draft", + "citation": "Admin, Test; Sit, Kevin K.; Goard, Michael J. (2023) Coregistration of heading to visual cues in retrosplenial cortex (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000005/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000005", "repository": "http://localhost:8085", "contributor": [ + { + "affiliation": [], + "email": "admin@nil.nil", + "includeInCitation": true, + "name": "Admin, Test", + "roleName": [ + "dcite:ContactPerson" + ], + "schemaKey": "Person" + }, { "name": "Tests, DANDI-Cli", "email": "nemo@example.com", diff --git a/dandi/cli/tests/data/update_dandiset_from_doi/neuron.json b/dandi/cli/tests/data/update_dandiset_from_doi/neuron.json index 6c66782bc..2661e7e62 100644 --- a/dandi/cli/tests/data/update_dandiset_from_doi/neuron.json +++ b/dandi/cli/tests/data/update_dandiset_from_doi/neuron.json @@ -13,11 +13,21 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Tingley, David; Buzs\u00e1ki, Gy\u00f6rgy (2023) Routing of Hippocampal Ripples to Subcortical Structures via the Lateral Septum (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000003/draft", + "citation": "Admin, Test; Tingley, David; Buzs\u00e1ki, Gy\u00f6rgy (2023) Routing of Hippocampal Ripples to Subcortical Structures via the Lateral Septum (Version draft) [Data set]. DANDI Archive. http://localhost:8085/dandiset/000003/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000003", "repository": "http://localhost:8085", "contributor": [ + { + "affiliation": [], + "email": "admin@nil.nil", + "includeInCitation": true, + "name": "Admin, Test", + "roleName": [ + "dcite:ContactPerson" + ], + "schemaKey": "Person" + }, { "name": "Tests, DANDI-Cli", "email": "nemo@example.com", From 080500fabb5f0233b5746bb4df01339a626b3617 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Wed, 28 May 2025 15:53:08 -0500 Subject: [PATCH 3/3] Remove failfast test hack --- dandi/dandiapi.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dandi/dandiapi.py b/dandi/dandiapi.py index 1b64eedb8..553ec672c 100644 --- a/dandi/dandiapi.py +++ b/dandi/dandiapi.py @@ -1106,10 +1106,6 @@ def wait_until_valid(self, max_time: float = 120) -> None: v = self.get_version(self.version_id) if v.status is VersionStatus.VALID and not v.asset_validation_errors: return - # TODO(asmacdo) can we fail fast? - if v.status is VersionStatus.INVALID: - break - sleep(0.5) # TODO: Improve the presentation of the error messages about = {