Skip to content

Commit

Permalink
fix(ps-and-pull): check if namespace already prepended (#9)
Browse files Browse the repository at this point in the history
Signed-off-by: tjzegmott <[email protected]>
  • Loading branch information
tjzegmott authored May 24, 2023
1 parent d5efe91 commit eba7532
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dtcli/ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def ps(scope: str, dataset: str, show_files: bool):
info_table.add_column("Size of Files [GB]", style="green")
if files["file_replica_locations"].get("minoc"):
minoc_files = files["file_replica_locations"]["minoc"]
size = cadcclient.size(os.path.commonpath(minoc_files))
common_path = os.path.commonpath(minoc_files)
if not common_path.startswith("data") or not common_path.startswith("/data"):
common_path = common_path.replace("cadc:CHIMEFRB", "")
size = cadcclient.size(common_path)
info_table.add_row("minoc", f"{len(minoc_files)}", f"{size:.2f}")
else:
info_table.add_row("minoc", str(0), str(0))
Expand Down
5 changes: 4 additions & 1 deletion dtcli/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def pull(
# Find files missing from localhost.
console.print(f"\nSearching for files for {dataset} {scope}...\n")
files = find_missing_dataset_files(scope, dataset)
to_download_size = size(path.commonpath(files["missing"]))
common_path = path.commonpath(files["missing"])
if common_path.startswith("cadc:CHIMEFRB"):
common_path = common_path.replace("cadc:CHIMEFRB", "")
to_download_size = size(common_path)
console.print(
f" - {len(files['existing'])} files found at {site}.",
style="green",
Expand Down

0 comments on commit eba7532

Please sign in to comment.