Spaces:
Running
Running
Add Space runtime smoke check
Browse filesFiles changed (3)
156 unmodified lines157158159160161162156 unmodified linesBefore pushing Space changes, run at least:```bashpython3 -B - <<'PY'from pathlib import Pathimport py_compile156 unmodified lines157158159160161162163164156 unmodified linesBefore pushing Space changes, run at least:```bashpython3 check_space_runtime.pypython3 -B - <<'PY'from pathlib import Pathimport py_compile
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455from __future__ import annotations
import asyncioimport tempfilefrom pathlib import Path
from frontend import local_server
def main() -> int: with tempfile.TemporaryDirectory(prefix="rh_space_check_") as tmp: runs_dir = Path(tmp) / "runs" local_server.configure_frontend( managed_runs_dir=str(runs_dir), cleanup_retention_seconds=60, cleanup_max_runs=2, cleanup_interval_seconds=60, collection_enabled=True, collection_dataset_repo="CoCoOne/ResearchHarness-Data", collection_batch_size=5, collection_max_bundle_bytes=1024 * 1024, )
collection_root = local_server._collection_root() if collection_root is None or not collection_root.exists(): raise RuntimeError("collection root was not created")
token = local_server._collection_token() if token is not None and not isinstance(token, str): raise RuntimeError("collection token helper returned a non-string value")
loop = asyncio.new_event_loop() try: bridge = local_server.FrontendRunBridge(loop=loop) workspace_root, trace_dir = local_server._create_managed_run(bridge) run_root = Path(bridge.managed_run_root) (workspace_root / "answer.txt").write_text("ok\n", encoding="utf-8") Path(trace_dir, "trace.jsonl").write_text('{"ok": true}\n', encoding="utf-8") bundle = local_server._write_collection_bundle( run_root, {"result_text": "ok", "termination": "result"}, ) if bundle is None or not bundle.exists(): raise RuntimeError("collection bundle was not created") local_server._release_managed_run(bridge) local_server.cleanup_managed_runs_once() finally: loop.close()
print("space runtime ok") return 0
if __name__ == "__main__": raise SystemExit(main())3 unmodified lines4567893 unmodified linesimport base64import datetime as _dtimport jsonimport reimport shutilimport threading3 unmodified lines456789103 unmodified linesimport base64import datetime as _dtimport jsonimport osimport reimport shutilimport threading
README.md+2
check_space_runtime.pyAdded+55
frontend/local_server.py+1