Skip to content

Commit

Permalink
fixup: handle PackageNotFound error
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhgrant committed May 24, 2024
1 parent 6cdf58f commit 3b49c30
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions deploy/deployctl/subcommands/dataproc_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ def start_cluster(name: str, cluster_args: typing.List[str]) -> None:
requirements_hail_version = next(
(line.strip().split("==")[1] for line in requirements_file if line.strip().startswith("hail==")), None
)
local_hail_version = importlib.metadata.version("hail")
try:
local_hail_version = importlib.metadata.version("hail")
except importlib.metadata.PackageNotFoundError:
raise RuntimeError("Hail must be installed locally")

if not requirements_hail_version or not local_hail_version:
raise RuntimeError("Hail must be both pinned in data-pipeline/requirements.txt, and installed locally")
if not requirements_hail_version:
raise RuntimeError("Hail must be pinned in data-pipeline/requirements.txt")
if requirements_hail_version != local_hail_version:
raise RuntimeError(
f"Local hail version differs from version pinned in data-pipeline/requirements.txt\nRequired version {requirements_hail_version}\nLocal version {local_hail_version}"
Expand Down

0 comments on commit 3b49c30

Please sign in to comment.