Skip to content

Commit f193fd1

Browse files
committed
use dandi for lindi download benchmark
1 parent 71b0d28 commit f193fd1

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/nwb_benchmarks/benchmarks/params_remote_download.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,22 @@
6262
https_url=get_https_url(
6363
dandiset_id="213889",
6464
dandi_path="sub-npI3/sub-npI3_behavior+ecephys.nwb.lindi.json",
65+
follow_redirects=False,
6566
),
6667
),
6768
dict(
6869
name="OphysTestCase",
6970
https_url=get_https_url(
7071
dandiset_id="213889",
7172
dandi_path="sub-R6_ses-20200206T210000_behavior+ophys/sub-R6_ses-20200206T210000_behavior+ophys.lindi.json",
73+
follow_redirects=False,
7274
),
7375
),
7476
dict(
7577
name="IcephysTestCase",
7678
https_url=get_https_url(
7779
dandiset_id="213889",
7880
dandi_path="sub-1214579789_ses-1214621812_icephys/sub-1214579789_ses-1214621812_icephys.lindi.json",
79-
),
81+
follow_redirects=False,),
8082
),
8183
)

src/nwb_benchmarks/benchmarks/time_download.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
"""Basic benchmarks for timing download of remote NWB files using different methods."""
22

3-
import os
43
import shutil
54

65
from asv_runner.benchmarks.mark import skip_benchmark_if
76
from dandi.download import download
87

98
from nwb_benchmarks import RUN_DOWNLOAD_BENCHMARKS
10-
from nwb_benchmarks.core import BaseBenchmark, download_file
9+
from nwb_benchmarks.core import BaseBenchmark
1110
from nwb_benchmarks.setup import get_temporary_directory
1211

1312
from .params_remote_download import hdf5_params, lindi_remote_rfs_params, zarr_params
@@ -56,22 +55,14 @@ def time_download_zarr_dandi_api(self, params: dict[str, str]):
5655
download(urls=params["https_url"], output_dir=self.tmpdir.name)
5756

5857

59-
class LindiDownloadFsspecBenchmark(BaseBenchmark):
58+
class LindiDownloadDandiAPIBenchmark(BaseDownloadDandiAPIBenchmark):
6059
"""
6160
Time the download of a remote LINDI JSON file.
6261
"""
6362

6463
params = lindi_remote_rfs_params
6564

66-
def setup(self, params: dict[str, str]):
67-
https_url = params["https_url"]
68-
self.lindi_file = os.path.basename(https_url) + ".lindi.json"
69-
self.teardown(params)
70-
71-
def teardown(self, params: dict[str, str]):
72-
if os.path.exists(self.lindi_file):
73-
os.remove(self.lindi_file)
74-
75-
def time_download_lindi_fsspec(self, params: dict[str, str]):
76-
https_url = params["https_url"]
77-
download_file(url=https_url, local_path=self.lindi_file)
65+
@skip_benchmark_if(not RUN_DOWNLOAD_BENCHMARKS)
66+
def time_download_lindi_dandi_api(self, params: dict[str, str]):
67+
"""Download a remote Lindi file using the DANDI API."""
68+
download(urls=params["https_url"], output_dir=self.tmpdir.name)

0 commit comments

Comments
 (0)