tao-shen Claude Opus 4.6 commited on
Commit
7098b1b
·
1 Parent(s): 9f8f146

fix: remove .cache dirs from rootfs before upload (HF API rejects them)

Browse files

The .cache dirs already existed in rootfs from previous syncs.
rsync --exclude only prevents NEW .cache from being synced but
doesn't delete existing ones. Clean up before upload.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. ubuntu-server/git_sync_daemon.py +10 -0
ubuntu-server/git_sync_daemon.py CHANGED
@@ -243,6 +243,16 @@ def save_and_upload():
243
  log(f" rsync done ({elapsed:.1f}s)")
244
  log(f" rootfs size: {disk_usage(ROOTFS)}")
245
 
 
 
 
 
 
 
 
 
 
 
246
  log("── UPLOAD: /data → dataset")
247
  api = HfApi(token=HF_TOKEN)
248
  ts = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())
 
243
  log(f" rsync done ({elapsed:.1f}s)")
244
  log(f" rootfs size: {disk_usage(ROOTFS)}")
245
 
246
+ # Clean up dirs that HF API rejects
247
+ for reject_dir in [".cache"]:
248
+ for dirpath, dirnames, filenames in os.walk(ROOTFS):
249
+ for d in list(dirnames):
250
+ if d == reject_dir:
251
+ full = os.path.join(dirpath, d)
252
+ log(f" Removing {full} (rejected by HF API)")
253
+ shutil.rmtree(full, ignore_errors=True)
254
+ dirnames.remove(d)
255
+
256
  log("── UPLOAD: /data → dataset")
257
  api = HfApi(token=HF_TOKEN)
258
  ts = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())