diff --git a/containers/run_script.py b/containers/run_script.py index d9ef332..7c60538 100644 --- a/containers/run_script.py +++ b/containers/run_script.py @@ -205,6 +205,9 @@ def main( - AWS_DEFAULT_REGION - AWS_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY + + If saving results to DANDI archive, the following ENV variables should be present: + - DANDI_API_TOKEN """ # Order of priority for definition of running arguments: @@ -317,7 +320,7 @@ def main( elif source == "dandi": dandiset_s3_file_url = source_data_paths["file"] - if not dandiset_s3_file_url.startswith("https://dandiarchive.s3.amazonaws.com"): + if not dandiset_s3_file_url.startswith("https://dandiarchive"): raise Exception(f"DANDISET_S3_FILE_URL should be a valid Dandiset S3 url. Value received was: {dandiset_s3_file_url}") if not test_with_subrecording: diff --git a/rest/clients/dandi.py b/rest/clients/dandi.py index e68d23b..21af51c 100644 --- a/rest/clients/dandi.py +++ b/rest/clients/dandi.py @@ -138,7 +138,9 @@ def get_nwbfile_info_fsspec(self, dandiset_id: str, file_path: str) -> dict: with h5py.File(f) as file: with pynwb.NWBHDF5IO(file=file, load_namespaces=True) as io: nwbfile = io.read() - return self.extract_nwbfile_info(nwbfile=nwbfile) + file_info = self.extract_nwbfile_info(nwbfile=nwbfile) + file_info["url"] = file_s3_url + return file_info def get_nwbfile_info_ros3(self, dandiset_id: str, file_path: str) -> dict: diff --git a/rest/routes/dandi.py b/rest/routes/dandi.py index 76c654b..24c40fa 100644 --- a/rest/routes/dandi.py +++ b/rest/routes/dandi.py @@ -45,7 +45,6 @@ async def route_get_nwbfile_info(dandiset_id: str, file_path: str) -> JSONRespon dandi_client = DandiClient(token=settings.DANDI_API_TOKEN) # file_info = dandi_client.get_nwbfile_info_ros3(dandiset_id, file_path) file_info = dandi_client.get_nwbfile_info_fsspec(dandiset_id, file_path) - file_info["url"] = dandi_client.get_file_url(dandiset_id, file_path) except Exception as e: print(e) raise HTTPException(status_code=500, detail="Internal server error") diff --git a/rest/routes/sorting.py b/rest/routes/sorting.py index 7780efd..c5629cc 100644 --- a/rest/routes/sorting.py +++ b/rest/routes/sorting.py @@ -25,6 +25,7 @@ def sorting_background_task(payload, run_identifier): client_local_worker.run_sorting(**payload) elif run_at == "aws": job_kwargs = {k.upper(): v for k, v in payload.items()} + job_kwargs["DANDI_API_TOKEN"] = settings.DANDI_API_TOKEN client_aws = AWSClient() client_aws.submit_job( job_name=f"sorting-{run_identifier}",