Skip to content

Commit

Permalink
pass correct url
Browse files Browse the repository at this point in the history
  • Loading branch information
luiztauffer committed Aug 16, 2023
1 parent 4031fec commit 11b0918
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion containers/run_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion rest/clients/dandi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion rest/routes/dandi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions rest/routes/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down

0 comments on commit 11b0918

Please sign in to comment.