29 lines
766 B
Python
29 lines
766 B
Python
from __future__ import annotations
|
|
|
|
import shutil
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
def build_gdc_command(manifest_path: Path, out_dir: Path, processes: int, retries: int) -> list[str]:
|
|
return [
|
|
"gdc-client",
|
|
"download",
|
|
"-m",
|
|
str(manifest_path),
|
|
"-d",
|
|
str(out_dir),
|
|
"--n-processes",
|
|
str(processes),
|
|
"--retry-count",
|
|
str(retries),
|
|
"--checksum",
|
|
]
|
|
|
|
|
|
def run_gdc_download(manifest_path: Path, out_dir: Path, processes: int = 4, retries: int = 3) -> None:
|
|
if not shutil.which("gdc-client"):
|
|
raise RuntimeError("gdc-client not found in PATH")
|
|
cmd = build_gdc_command(manifest_path, out_dir, processes, retries)
|
|
subprocess.run(cmd, check=True)
|