Skip to content

Static layers: close the scratch rasters before removing the scratch directory - #411

Open
lijun99 wants to merge 1 commit into
isce-framework:developfrom
lijun99:fix-static-scratch-nfs
Open

lijun99 wants to merge 1 commit into
isce-framework:developfrom
lijun99:fix-static-scratch-nfs

Conversation

@lijun99

@lijun99 lijun99 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

The static layers workflow writes its intermediate layers as GeoTIFFs in the scratch directory and keeps them open (isce3.io.Raster objects) until run_static_layers_workflow returns, i.e., after scratch_directory has removed the directory with shutil.rmtree.

  • On local file systems, removing open files succeeds.
  • On NFS, the client renames an open file that is removed to a hidden .nfsXXXX file, so the directory is not empty and rmtree fails with OSError: [Errno 39] Directory not empty: 'scratch'.

The same NFS behavior was reported in #207 for the scratch directory of nisarqa, when running the RSLC and InSAR PGEs with the working directory on NFS (at HECC, and on the on-demand systems). So the static layers workflow can fail in the same environments.

This PR closes these rasters with Raster.close_dataset() at the end of the scratch_directory block, after they are written to the product, so the files are closed before the directory is removed.

Testing: tests/python/packages/nisar/workflows/static.py was run from a directory on NFS.

  • Before: the first test case failed, leaving 8 .nfsXXXX files in scratch, one for each open raster. The second case passed only because scratch then existed and was not removed.
  • After: both cases pass, and scratch is removed.

This branch has not been deployed

No deployments
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