Skip to content

Commit

Permalink
More verbose logging when downloading large datasets.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCummins committed Oct 6, 2021
1 parent 5b0be47 commit 4fe4585
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions compiler_gym/datasets/tar_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ def install(self) -> None:
# Remove any partially-completed prior extraction.
shutil.rmtree(self.site_data_path / "contents", ignore_errors=True)

logger.info("Downloading %s dataset", self.name)
logger.warning(
"Installing the %s dataset. This may take a few moments ...", self.name
)

tar_data = io.BytesIO(download(self.tar_urls, self.tar_sha256))
logger.info("Unpacking %s dataset", self.name)
logger.info("Unpacking %s dataset to %s", self.name, self.site_data_path)
with tarfile.open(
fileobj=tar_data, mode=f"r:{self.tar_compression}"
) as arc:
Expand Down
7 changes: 7 additions & 0 deletions compiler_gym/third_party/llvm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# LICENSE file in the root directory of this source tree.
"""Module for resolving paths to LLVM binaries and libraries."""
import io
import logging
import shutil
import sys
import tarfile
Expand All @@ -16,6 +17,8 @@
from compiler_gym.util.download import download
from compiler_gym.util.runfiles_path import cache_path, site_data_path

logger = logging.getLogger(__name__)

# The data archive containing LLVM binaries and libraries.
_LLVM_URL, _LLVM_SHA256 = {
"darwin": (
Expand All @@ -37,6 +40,10 @@

def _download_llvm_files(destination: Path) -> Path:
"""Download and unpack the LLVM data pack."""
logger.warning(
"Installing the CompilerGym LLVM environment runtime. This may take a few moments ..."
)

# Tidy up an incomplete unpack.
shutil.rmtree(destination, ignore_errors=True)

Expand Down

0 comments on commit 4fe4585

Please sign in to comment.