Spaces:
Running on Zero
Running on Zero
Rolling cache checkpoint, hourly cadence
Browse files441 unmodified lines44244344444544644744854 unmodified lines503504505506507508509441 unmodified linestar_path = WORK / "buildstore_cache.tar"with tarfile.open(tar_path, "w") as tar:tar.add(BUILD_CACHE_DIR, arcname=".trajpatch_cache_build")push_file("buildstore_cache", tar_path.read_bytes())return tar_path.name54 unmodified lines"cache_restored_from": restored,"elapsed_pushes": pushes, "tail": tail})).encode("utf-8"))if pushes % 4 == 0: # persist the memory cache every ~20 min_persist_build_cache(api)except Exception: # noqa: BLE001 - progress/cache pushes must never kill the stagepass441 unmodified lines44244344444544644744844945045145245345445545645754 unmodified lines512513514515516517518441 unmodified linestar_path = WORK / "buildstore_cache.tar"with tarfile.open(tar_path, "w") as tar:tar.add(BUILD_CACHE_DIR, arcname=".trajpatch_cache_build")# single rolling checkpoint: upload the new one, then delete the previous# blob so the repo does not accumulate hundreds of MB per checkpointfiles = api.list_repo_files(repo_id=DEST_MIRROR, repo_type="dataset")previous = [f for f in files if f.endswith("buildstore_cache.tar")]push_file("buildstore_cache", tar_path.read_bytes())for old in previous:try:api.delete_file(old, repo_id=DEST_MIRROR, repo_type="dataset")except Exception: # noqa: BLE001passreturn tar_path.name54 unmodified lines"cache_restored_from": restored,"elapsed_pushes": pushes, "tail": tail})).encode("utf-8"))if pushes % 12 == 0: # persist the memory cache hourly_persist_build_cache(api)except Exception: # noqa: BLE001 - progress/cache pushes must never kill the stagepass
executor_entrypoint.py+10-1