Skip to content

Commit

Permalink
feat(data-pipelines): allow pinning of hail in requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhgrant committed May 24, 2024
1 parent 7149dfe commit 5937278
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data-pipeline/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
elasticsearch~=7.17
hail
hail==0.2.127
tqdm
loguru
attrs
Expand Down
15 changes: 15 additions & 0 deletions deploy/deployctl/subcommands/dataproc_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import subprocess
import sys
import typing
import re
import importlib.metadata

from deployctl.config import config

Expand All @@ -24,6 +26,19 @@ def start_cluster(name: str, cluster_args: typing.List[str]) -> None:
raise RuntimeError("project configuration is required")

with open(os.path.join(DATA_PIPELINE_DIRECTORY, "requirements.txt")) as requirements_file:
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")

if not requirements_hail_version or not local_hail_version:
raise RuntimeError(f"Hail must be both pinned in data-pipeline/requirements.txt, and installed locally")
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}"
)

requirements_file.seek(0)
requirements = [line.strip() for line in requirements_file.readlines()]

subprocess.check_output(
Expand Down

0 comments on commit 5937278

Please sign in to comment.