Buckets:

glennmatlin's picture
download
raw
1.22 kB
#!/usr/bin/env python3
"""Fail if sampling-comparison report metadata is not manifest-backed."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
def check_metadata(path: Path) -> list[str]:
if not path.exists():
return [f"missing metadata file: {path}"]
metadata = json.loads(path.read_text())
inputs = metadata.get("inputs", {})
errors: list[str] = []
if inputs.get("used_dummy") is True:
errors.append(f"{path}: used_dummy=true")
for key in ("stratified_manifest", "representative_manifest"):
value = inputs.get(key)
if not value:
errors.append(f"{path}: missing {key}")
return errors
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("metadata", type=Path, nargs="+")
args = parser.parse_args()
errors: list[str] = []
for path in args.metadata:
errors.extend(check_metadata(path))
if errors:
print("Sampling provenance check failed:")
for error in errors:
print(f"- {error}")
return 1
print("Sampling provenance check passed.")
return 0
if __name__ == "__main__":
raise SystemExit(main())

Xet Storage Details

Size:
1.22 kB
·
Xet hash:
803d36f4da7b78d485240f021729476937b02e7890e7129602cc18cf507aa75b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.