Skip to content

Fix gs:// cache detection in _remote_file_exists#8

Merged
tylere merged 1 commit into
mainfrom
fix/gs-cache-exists
Jul 17, 2026
Merged

Fix gs:// cache detection in _remote_file_exists#8
tylere merged 1 commit into
mainfrom
fix/gs-cache-exists

Conversation

@tylere

@tylere tylere commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Why

make_aoo_grid_cached reads and writes gs:// caches via pyarrow's native GCS backend (gpd.read_parquet / to_parquet), but _remote_file_exists checked existence via fsspec, which needs gcsfs. When gcsfs isn't installed, _remote_file_exists('gs://…') silently returns False — so a present cache is never detected and the AOO grid is recomputed from the full national ecosystem map (a multi-GB, OOM-prone operation). This is exactly what defeated a gs://-hosted AOO grid cache and kept OOM-killing a country render.

What

Route gs:// through pyarrow.fs.GcsFileSystem.get_file_info (consistent with the read/write path, no gcsfs dependency). Local and other paths still use fsspec.

Verification

  • New TestRemoteFileExists unit tests: gs:// uses pyarrow (not fsspec), missing gs:// → False, local paths still work. Written test-first (the gs:// test fails on the old code). Full test_aoo.py suite: 46 passed.
  • Against a real gs:// cache end-to-end: _remote_file_exists now True, and make_aoo_grid_cached returns 12,030 cells in 4.5 s at 0.2 GB peak RSS (vs ~11 GB when it recomputed).

🤖 Generated with Claude Code

make_aoo_grid_cached reads and writes gs:// caches via pyarrow's native GCS
backend (gpd.read_parquet / to_parquet), but the existence check used fsspec,
which needs gcsfs. When gcsfs is absent, _remote_file_exists('gs://...')
silently returned False, so a present cache was never detected and the AOO
grid was recomputed from the full national ecosystem map — a multi-GB,
OOM-prone operation that defeats the cache entirely.

Route gs:// through pyarrow.fs.GcsFileSystem (consistent with the read/write
path, no gcsfs dependency); keep fsspec for local and other paths.

Verified against a real gs:// cache: existence now True, make_aoo_grid_cached
returns 12,030 cells in 4.5s at 0.2 GB peak RSS (vs ~11 GB when recomputing).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant