1313DEFAULT_SERVER_STARTUP_SECONDS = 600.0
1414
1515
16- def _default_shared_drive_root () -> pathlib .Path :
17- """Return the shared drive root, falling back to a local cache dir.
18-
19- In CI, CI_SHARED_DRIVE_PATH points to a shared PVC mounted across all
20- runners, so assets/models/submodules downloaded on one run are reused on
21- the next without re-downloading.
22-
23- On dev machines (CI_SHARED_DRIVE_PATH unset), the fallback is
24- ~/.cache/g00t — a local directory that plays the same caching role so
25- tests work identically without any extra setup.
26- """
27- if "CI_SHARED_DRIVE_PATH" in os .environ :
28- return pathlib .Path (os .environ ["CI_SHARED_DRIVE_PATH" ])
16+ def _default_cache_path () -> pathlib .Path :
17+ """Return the cache root directory."""
18+ if "TEST_CACHE_PATH" in os .environ :
19+ return pathlib .Path (os .environ ["TEST_CACHE_PATH" ])
2920
3021 local_fallback = pathlib .Path .home () / ".cache" / "g00t"
3122 local_fallback .mkdir (parents = True , exist_ok = True )
3223 return local_fallback
3324
3425
35- # In CI: shared PVC path from CI_SHARED_DRIVE_PATH.
36- # On dev machines: ~/.cache/g00t (created automatically).
37- SHARED_DRIVE_ROOT = _default_shared_drive_root ()
26+ TEST_CACHE_PATH = _default_cache_path ()
3827
3928
4029def get_root () -> pathlib .Path :
@@ -120,29 +109,29 @@ def find_nvidia_egl_vendor_file() -> pathlib.Path:
120109
121110
122111def resolve_shared_uv_cache_dir () -> pathlib .Path | None :
123- """Return a writable shared uv cache path common to all tests , or None.
112+ """Return a writable uv cache path, or None.
124113
125- Only redirects the uv cache when CI_SHARED_DRIVE_PATH is set — on dev
114+ Only redirects the uv cache when TEST_CACHE_PATH is set — on dev
126115 machines uv's default cache (~/.cache/uv) is already local and fast, so
127116 there is no benefit to overriding it.
128117 """
129- if "CI_SHARED_DRIVE_PATH " not in os .environ :
118+ if "TEST_CACHE_PATH " not in os .environ :
130119 return None
131- cache_dir = SHARED_DRIVE_ROOT / "uv-cache"
120+ cache_dir = TEST_CACHE_PATH / "uv-cache"
132121 try :
133122 cache_dir .mkdir (parents = True , exist_ok = True )
134123 return cache_dir
135124 except OSError :
136125 print (
137- f"[cache] warning: shared uv cache unavailable at { cache_dir } ; "
126+ f"[cache] warning: uv cache unavailable at { cache_dir } ; "
138127 "falling back to uv default cache dir"
139128 )
140129 return None
141130
142131
143132def build_shared_hf_cache_env (cache_key : str ) -> dict [str , str ]:
144- """Build HF cache environment variables under shared storage for a cache key."""
145- hf_cache_dir = SHARED_DRIVE_ROOT / f"hf-cache/{ cache_key } "
133+ """Build HF cache environment variables for a cache key."""
134+ hf_cache_dir = TEST_CACHE_PATH / f"hf-cache/{ cache_key } "
146135 try :
147136 hub_cache_dir = hf_cache_dir / "hub"
148137 transformers_cache_dir = hf_cache_dir / "transformers"
@@ -152,7 +141,7 @@ def build_shared_hf_cache_env(cache_key: str) -> dict[str, str]:
152141 datasets_cache_dir .mkdir (parents = True , exist_ok = True )
153142 except OSError :
154143 print (
155- f"[cache] warning: shared Hugging Face cache unavailable at { hf_cache_dir } ; "
144+ f"[cache] warning: Hugging Face cache unavailable at { hf_cache_dir } ; "
156145 "falling back to defaults"
157146 )
158147 return {}
@@ -171,7 +160,7 @@ def build_uv_runtime_env(
171160 uv_cache_dir : pathlib .Path | None = None ,
172161 extra_env : dict [str , str ] | None = None ,
173162) -> dict [str , str ]:
174- """Build a runtime env with shared uv cache and venv selection.
163+ """Build a runtime env with uv cache and venv selection.
175164
176165 UV_PROJECT_ENVIRONMENT tells uv which venv to use when running subprocesses
177166 (e.g. ``uv run python ...``). We forward the currently active venv so that
@@ -197,16 +186,14 @@ def build_shared_runtime_env(
197186 * ,
198187 extra_env : dict [str , str ] | None = None ,
199188) -> dict [str , str ]:
200- """Build runtime env with shared uv cache and per-test HF cache."""
189+ """Build runtime env with uv cache and per-test HF cache."""
201190 uv_cache_dir = resolve_shared_uv_cache_dir ()
202191 merged_extra_env = {** build_shared_hf_cache_env (cache_key )}
203192 if extra_env :
204193 merged_extra_env .update (extra_env )
205194 env = build_uv_runtime_env (uv_cache_dir = uv_cache_dir , extra_env = merged_extra_env )
206195
207- shared_drive_source = (
208- "CI_SHARED_DRIVE_PATH" if "CI_SHARED_DRIVE_PATH" in os .environ else "local fallback"
209- )
196+ cache_source = "TEST_CACHE_PATH" if "TEST_CACHE_PATH" in os .environ else "local fallback"
210197 uv_cache_str = str (uv_cache_dir ) if uv_cache_dir is not None else "uv default"
211198 uv_venv = env .get ("UV_PROJECT_ENVIRONMENT" , "uv default" )
212199 uv_venv_source = (
@@ -218,7 +205,7 @@ def build_shared_runtime_env(
218205 )
219206 hf_home = env .get ("HF_HOME" , "hf default" )
220207 print (
221- f"[cache] shared_drive_root= { SHARED_DRIVE_ROOT } ({ shared_drive_source } )"
208+ f"[cache] cache_path= { TEST_CACHE_PATH } ({ cache_source } )"
222209 f" uv_cache={ uv_cache_str } "
223210 f" uv_venv={ uv_venv } ({ uv_venv_source } )"
224211 f" hf_home={ hf_home } (key={ cache_key } )" ,
0 commit comments