MCPcopy Create free account
hub / github.com/Ropedia/SpatialBench / _save_partial

Function _save_partial

benchmark/evaluation/run_benchmark.py:375–393  ·  view source on GitHub ↗

Atomic write of partial progress. Failures are logged and swallowed.

(partial_path, signature, all_results, timing_accum)

Source from the content-addressed store, hash-verified

373
374
375def _save_partial(partial_path, signature, all_results, timing_accum):
376 """Atomic write of partial progress. Failures are logged and swallowed."""
377 tmp_path = partial_path + ".tmp"
378 try:
379 os.makedirs(os.path.dirname(partial_path) or '.', exist_ok=True)
380 with open(tmp_path, 'w') as f:
381 json.dump({
382 "signature": signature,
383 "all_results": all_results,
384 "timing_accum": timing_accum,
385 }, f, default=str)
386 os.replace(tmp_path, partial_path)
387 except Exception as e:
388 print(f"[resume] failed to write {partial_path}: {e}")
389 try:
390 if os.path.isfile(tmp_path):
391 os.unlink(tmp_path)
392 except Exception:
393 pass
394
395
396def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected