Swordnael commited on
Commit
ccf6b90
·
verified ·
1 Parent(s): 7b30e32

Finalize persisted smoke evidence

Browse files
training/run_fable_router_structural_smoke.py CHANGED
@@ -169,6 +169,16 @@ def upload_evidence(output: Path, repo_id: str, token: str) -> dict[str, Any]:
169
  return {"repo": repo_id, "private": True, "path": f"runs/{prefix}"}
170
 
171
 
 
 
 
 
 
 
 
 
 
 
172
  def run(args: argparse.Namespace, result: dict[str, Any]) -> None:
173
  config_path = args.config.resolve()
174
  config = read_json(config_path)
@@ -467,6 +477,7 @@ def main() -> int:
467
  if token:
468
  result["evidenceUpload"] = upload_evidence(output, config["smoke"]["resultRepo"], token)
469
  result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
 
470
  except BaseException as exc:
471
  result["evidenceUpload"] = {"status": "failed", "error": str(exc)}
472
  result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
@@ -476,4 +487,3 @@ def main() -> int:
476
 
477
  if __name__ == "__main__":
478
  raise SystemExit(main())
479
-
 
169
  return {"repo": repo_id, "private": True, "path": f"runs/{prefix}"}
170
 
171
 
172
+ def upload_final_result(output: Path, repo_id: str, token: str) -> None:
173
+ HfApi(token=token).upload_file(
174
+ path_or_fileobj=str(output / "result.json"),
175
+ path_in_repo=f"runs/{output.name}/result.json",
176
+ repo_id=repo_id,
177
+ repo_type="dataset",
178
+ commit_message=f"Finalize non-routing structural smoke {output.name}",
179
+ )
180
+
181
+
182
  def run(args: argparse.Namespace, result: dict[str, Any]) -> None:
183
  config_path = args.config.resolve()
184
  config = read_json(config_path)
 
477
  if token:
478
  result["evidenceUpload"] = upload_evidence(output, config["smoke"]["resultRepo"], token)
479
  result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
480
+ upload_final_result(output, config["smoke"]["resultRepo"], token)
481
  except BaseException as exc:
482
  result["evidenceUpload"] = {"status": "failed", "error": str(exc)}
483
  result_path.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
 
487
 
488
  if __name__ == "__main__":
489
  raise SystemExit(main())