Skip to content

fix: keep scratch dirs off NFS - #18

Merged
dfguerrerom merged 4 commits into
mainfrom
fix/scratch-dir-off-nfs
Jul 31, 2026
Merged

fix: keep scratch dirs off NFS#18
dfguerrerom merged 4 commits into
mainfrom
fix/scratch-dir-off-nfs

Conversation

@dfguerrerom

Copy link
Copy Markdown
Contributor

tempfile.mkdtemp() resolves to /tmp, which on a SEPAL sandbox is an nfs4 mount of the home export — slow for many small writes, and counted against the storage quota. The sample-points layer feels it most: tippecanoe scratches alongside its output, so the directory build_sample_points_layer picks decides how long tile generation takes. Profiling a sandbox, 1000 points took 28.3s with the scratch on NFS and 0.44s with it on local disk, and the cost tracks tile count rather than point count, so small designs pay the same.

Routes the three temp dirs (map.py, state_manager.py, geospatial.py) through pysepal's scratch_dir(), which prefers container-local /var/tmp on SEPAL and the standard temp dir everywhere else. Also bumps vectortileserver to >=0.2.1: that release passes tippecanoe --temporary-directory, without which only the output moves and generation stays slow.

Blocked on a publish: vectortileserver 0.2.1 is tagged on GitHub but not yet on PyPI, so the environment build — and therefore CI — will fail until it is. pysepal 3.8.1 (which ships pysepal.scripts.scratch) is released, and the env already tracks pysepal main.

198 tests pass locally. One test that monkeypatched map_mod.tempfile.mkdtemp now patches scratch_dir; two comments naming mkdtemp were updated.

tempfile.mkdtemp() lands on /tmp, which on a SEPAL sandbox is NFS. For the
sample-points layer that decides how long tile generation takes, since tippecanoe
scratches alongside its output. Route the three temp dirs through pysepal's
scratch_dir().

Needs a pysepal that ships pysepal.scripts.scratch.
0.2.1 passes tippecanoe --temporary-directory, so the local dest_dir this branch
introduces also moves tippecanoe's scratch off NFS. With 0.2.0 only the output
moves and tile generation stays slow.
3.8.1 ships pysepal.scripts.scratch, so the git dependency is no longer needed.
Also drops comments whose context lives in the PR.
@dfguerrerom
dfguerrerom merged commit 62de7a5 into main Jul 31, 2026
2 checks passed
@dfguerrerom
dfguerrerom deleted the fix/scratch-dir-off-nfs branch July 31, 2026 14:22
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