Skip to content

Commit

Permalink
retry transient errors when downloading artefacts
Browse files Browse the repository at this point in the history
  • Loading branch information
ehigham committed Nov 19, 2024
1 parent 5f975f6 commit fe59078
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions hail/python/benchmark/hail/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest

import hail as hl
from hailtop.utils import async_to_blocking, retry_transient_errors


@pytest.fixture(scope='session')
Expand All @@ -23,20 +24,23 @@ def resource_dir(request, tmpdir_factory):
gs_curl_root = 'https://storage.googleapis.com/hail-common/benchmark'


def __download(data_dir, filename):
async def __download(data_dir, filename):
url = os.path.join(gs_curl_root, filename)
logging.info(f'downloading: {filename}')
# Note: the below does not work on batch due to docker/ssl problems
# dest = os.path.join(data_dir, filename)
# urlretrieve(url, dest)
subprocess.check_call(['curl', url, '-Lfs', '--output', f'{data_dir / filename}'])
logging.info(f'done: {filename}')


def localize(path: Path):
if not path.exists():
path.parent.mkdir(parents=True, exist_ok=True)
__download(path.parent, path.name)
async_to_blocking(
retry_transient_errors(
__download,
path.parent,
path.name,
)
)

return path

Expand Down

0 comments on commit fe59078

Please sign in to comment.