Create the runtime directories and export env vars for subprocesses. Idempotent. Safe to call from any entry point before path-dependent work. Exports ``HOST_WORKSPACE`` and ``WORKSPACE_PERSISTENT`` so Docker containers and shell scripts spawned by the current process see the same absol
()
| 176 | |
| 177 | |
| 178 | def ensure_runtime_dirs() -> None: |
| 179 | """Create the runtime directories and export env vars for subprocesses. |
| 180 | |
| 181 | Idempotent. Safe to call from any entry point before path-dependent work. |
| 182 | Exports ``HOST_WORKSPACE`` and ``WORKSPACE_PERSISTENT`` so Docker containers |
| 183 | and shell scripts spawned by the current process see the same absolute |
| 184 | paths Python is using. |
| 185 | """ |
| 186 | ws = host_workspace() |
| 187 | wp = workspace_persistent() |
| 188 | ws.mkdir(parents=True, exist_ok=True) |
| 189 | (wp / "outputs").mkdir(parents=True, exist_ok=True) |
| 190 | os.environ.setdefault("HOST_WORKSPACE", str(ws)) |
| 191 | os.environ.setdefault("WORKSPACE_PERSISTENT", str(wp)) |