-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support gzipped g cloud benchmark bucket files (#218)
- Loading branch information
Showing
4 changed files
with
101 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/resources/io/deephaven/benchmark/run/profile/parallel_download.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import asyncio, re, os, traceback | ||
from urllib.request import urlretrieve | ||
|
||
def background(f): | ||
def wrapped(*args, **kwargs): | ||
return asyncio.get_event_loop().run_in_executor(None, f, *args, **kwargs) | ||
return wrapped | ||
|
||
@background | ||
def download(url): | ||
try: | ||
out_path = re.sub('^http.*/deephaven-benchmark/', 'data/deephaven-benchmark/', url) | ||
os.makedirs(os.path.dirname(out_path), mode=0o777, exist_ok=True) | ||
except Exception: | ||
print('Error downloading file:', download, ':', traceback.format_exc()) | ||
return | ||
try: | ||
urlretrieve(url + '.gz', out_path + '.gz') | ||
print('Got', out_path + '.gz') | ||
except Exception: | ||
try: | ||
urlretrieve(url, out_path) | ||
print('Got', out_path) | ||
except Exception: | ||
print('Error downloading file:', out_path, ':', traceback.format_exc()) | ||
|
||
urls = [ | ||
${downloadUrls} | ||
] | ||
|
||
for url in urls: | ||
download(url) |