Skip to content

adding the capability to retry a download. #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: update.redisearch
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions benchmark/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,20 @@ def download(self):

if self.config.link:
print(f"Downloading {self.config.link}...")
tmp_path, _ = urllib.request.urlretrieve(
self.config.link, None, show_progress
)

remaining_download_tries = 15
while remaining_download_tries > 0 :
try:
tmp_path, _ = urllib.request.urlretrieve(
self.config.link, None, show_progress
)
print(f"Download succeded.")
except:
print(f"Download failed. Retrying...")
remaining_download_tries = remaining_download_tries - 1
continue
else:
break

if self.config.link.endswith(".tgz") or self.config.link.endswith(
".tar.gz"
Expand Down