Kevin589981 commited on
Commit
ed3035d
·
verified ·
1 Parent(s): dbc620e

fix clean-clone task materialization

Browse files
Files changed (1) hide show
  1. tools/materialize.py +11 -1
tools/materialize.py CHANGED
@@ -24,6 +24,16 @@ def load_rows() -> list[dict[str, object]]:
24
  return [json.loads(line) for line in (ROOT / "manifests" / "tasks.jsonl").read_text(encoding="utf-8").splitlines() if line.strip()]
25
 
26
 
 
 
 
 
 
 
 
 
 
 
27
  def main() -> int:
28
  parser = argparse.ArgumentParser(description=__doc__)
29
  parser.add_argument("--output", type=Path, default=ROOT / "tasks-selected")
@@ -51,7 +61,7 @@ def main() -> int:
51
  shutil.rmtree(args.output)
52
  args.output.mkdir(parents=True)
53
  for row in rows:
54
- source = ROOT / str(row["task_path"])
55
  destination = args.output / source.name
56
  if args.include_build_context:
57
  if not (source / "environment" / "repo").is_dir():
 
24
  return [json.loads(line) for line in (ROOT / "manifests" / "tasks.jsonl").read_text(encoding="utf-8").splitlines() if line.strip()]
25
 
26
 
27
+ def task_source(task_path: str, *, root: Path = ROOT) -> Path:
28
+ source = root / task_path
29
+ if source.is_dir():
30
+ return source
31
+ snapshot_source = root / "huggingface" / task_path
32
+ if snapshot_source.is_dir():
33
+ return snapshot_source
34
+ raise FileNotFoundError(f"task bundle is absent from local and HF snapshots: {task_path}")
35
+
36
+
37
  def main() -> int:
38
  parser = argparse.ArgumentParser(description=__doc__)
39
  parser.add_argument("--output", type=Path, default=ROOT / "tasks-selected")
 
61
  shutil.rmtree(args.output)
62
  args.output.mkdir(parents=True)
63
  for row in rows:
64
+ source = task_source(str(row["task_path"]))
65
  destination = args.output / source.name
66
  if args.include_build_context:
67
  if not (source / "environment" / "repo").is_dir():