|
1 | 1 | """Basic benchmarks for timing download of remote NWB files using different methods.""" |
2 | 2 |
|
3 | | -import os |
4 | 3 | import shutil |
5 | 4 |
|
6 | 5 | from asv_runner.benchmarks.mark import skip_benchmark_if |
7 | 6 | from dandi.download import download |
8 | 7 |
|
9 | 8 | from nwb_benchmarks import RUN_DOWNLOAD_BENCHMARKS |
10 | | -from nwb_benchmarks.core import BaseBenchmark, download_file |
| 9 | +from nwb_benchmarks.core import BaseBenchmark |
11 | 10 | from nwb_benchmarks.setup import get_temporary_directory |
12 | 11 |
|
13 | 12 | 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]): |
56 | 55 | download(urls=params["https_url"], output_dir=self.tmpdir.name) |
57 | 56 |
|
58 | 57 |
|
59 | | -class LindiDownloadFsspecBenchmark(BaseBenchmark): |
| 58 | +class LindiDownloadDandiAPIBenchmark(BaseDownloadDandiAPIBenchmark): |
60 | 59 | """ |
61 | 60 | Time the download of a remote LINDI JSON file. |
62 | 61 | """ |
63 | 62 |
|
64 | 63 | params = lindi_remote_rfs_params |
65 | 64 |
|
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