Avoid lazy NetCDF writes during evaluation#133
Merged
Conversation
Evaluation metric and score results are materialized before NetCDF output so source-file reads do not overlap with HDF5 writes on Windows runners. Constraint: netCDF4/HDF5 can hang when lazy source reads overlap target writes on Windows CI. Rejected: Eager loading inside write_netcdf_atomic | would force large mfdataset combine paths into memory. Confidence: high Scope-risk: narrow Directive: Keep large-file combine paths lazy unless a caller explicitly materializes bounded outputs. Tested: python -m pytest tests/test_netcdf_lifecycle_atomic.py tests/test_performance_optimizations.py -q; python -m ruff check src/openbench/core/evaluation.py tests/test_netcdf_lifecycle_atomic.py; python -m ruff format --check src/openbench/core/evaluation.py tests/test_netcdf_lifecycle_atomic.py Not-tested: Full GitHub Actions matrix after this commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Why
Windows/netCDF4 can hang when
to_netcdf()writes an output file while still lazily reading source NetCDF arrays. This mirrors the station scanner pattern that separates source reads from target HDF5 writes.Validation
python -m pytest tests/test_netcdf_lifecycle_atomic.py tests/test_performance_optimizations.py -qpython -m ruff check src/openbench/core/evaluation.py tests/test_netcdf_lifecycle_atomic.pypython -m ruff format --check src/openbench/core/evaluation.py tests/test_netcdf_lifecycle_atomic.py