MHamdan commited on
Commit
c4b67b0
·
verified ·
1 Parent(s): 67ba593

CI deploy dae0cf5

Browse files
Files changed (3) hide show
  1. api/main.py +13 -0
  2. build_info.json +1 -1
  3. scripts/d2_space_proof.py +7 -1
api/main.py CHANGED
@@ -16,6 +16,19 @@ try:
16
  except Exception:
17
  pass
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  # Inference-only server tuning — helps on weak/CPU hosts (e.g. a free CPU tier).
20
  try:
21
  import torch
 
16
  except Exception:
17
  pass
18
 
19
+ # Fully initialize huggingface_hub at import time (single-threaded) BEFORE any background thread
20
+ # imports it. huggingface_hub 1.20.1 can hit a partial-init circular import
21
+ # (``cannot import name 'XetConnectionInfo' from huggingface_hub.utils._xet``) when the weight
22
+ # auto-download thread and the D2 bucket-store construction import it concurrently at startup —
23
+ # which surfaces as ``HFBucketUnavailable`` and disables D2 persistence. Forcing the full import
24
+ # chain (including the Storage Buckets API) here eliminates that race.
25
+ try:
26
+ import huggingface_hub # noqa: F401
27
+ from huggingface_hub import (batch_bucket_files, bucket_info, # noqa: F401
28
+ download_bucket_files, list_bucket_tree)
29
+ except Exception:
30
+ pass
31
+
32
  # Inference-only server tuning — helps on weak/CPU hosts (e.g. a free CPU tier).
33
  try:
34
  import torch
build_info.json CHANGED
@@ -1 +1 @@
1
- {"commit":"a7d795f","build_time":"2026-07-14T16:37:16Z","frontend":"1.0.0"}
 
1
+ {"commit":"dae0cf5","build_time":"2026-07-14T17:02:44Z","frontend":"1.0.0"}
scripts/d2_space_proof.py CHANGED
@@ -218,7 +218,13 @@ def _stage_full() -> dict:
218
 
219
  storage = D2Storage(config=cfg, object_store=_bucket(), source_commit=_deployed_commit(),
220
  store_key=key)
221
- ev: dict = {"outcome": "", "init_recovery": storage.open()}
 
 
 
 
 
 
222
  try:
223
  facts = _runtime_facts(storage)
224
  facts.update(_integrity(cfg.db_path))
 
218
 
219
  storage = D2Storage(config=cfg, object_store=_bucket(), source_commit=_deployed_commit(),
220
  store_key=key)
221
+ # Idempotent synthetic run: always start from a CLEAN local DB (this is throwaway proof data).
222
+ # Opening with recover=True would restore prior synthetic accounts from the bucket and then a
223
+ # fresh bootstrap would collide (handle_taken), so wipe the local DB and open without recovery.
224
+ for p in (cfg.db_path, cfg.wal_path, cfg.shm_path):
225
+ with contextlib.suppress(OSError):
226
+ os.remove(p)
227
+ ev: dict = {"outcome": "", "init_recovery": storage.open(recover=False)}
228
  try:
229
  facts = _runtime_facts(storage)
230
  facts.update(_integrity(cfg.db_path))