Issue 538: Skip individual split files that already exist#548
Open
mmarusiak wants to merge 1 commit into
Open
Conversation
Previously, all three splitters used an all-or-nothing approach: if any output file existed (via wildcard match), the entire input file was skipped. If even one output file was missing, the splitter re-split the whole input and overwrote all previously created children. Now each splitter checks existence per output file and only generates the missing ones: - GribSplitter: replaced the upfront should_skip() guard with a per-key should_skip_file() check inside the message loop, using a skipped_keys set to avoid redundant filesystem calls for the same output path. - GribSplitterV2: already checked per-file before running grib_copy, but the upload loop was copying every file grib_copy produced (including already-existing ones). Fixed by filtering the upload loop to only paths in output_paths. - NetCdfSplitter: removed the upfront should_skip() guard and moved the existence check into _write_dataset(), which now returns a bool so split_data() can track how many files were actually written. Added test_splits_only_missing_files for both GribSplitter/GribSplitterV2 (parametrized) and NetCdfSplitter: full split, delete one output file, re-split, assert only the deleted file was recreated and all others have unchanged modification times.
j9sh264
reviewed
Jul 20, 2026
| if key not in outputs: | ||
| if self.should_skip_file(key): | ||
| skipped_keys.add(key) | ||
| del grb |
Collaborator
There was a problem hiding this comment.
We should log these skipped files to improve pipeline telemetry and simplify troubleshooting downstream.
j9sh264
reviewed
Jul 20, 2026
| for flat_target in os.listdir(tmpdir): | ||
| dest_file_path = f'{prefix}{flat_target.replace(delimiter, slash)}' | ||
| if dest_file_path not in output_paths_set: | ||
| continue |
Collaborator
There was a problem hiding this comment.
Same here, let's log these skipped files.
j9sh264
reviewed
Jul 20, 2026
| # Storing data in HDF5 is advantageous since it allows opening NetCDF files with buffered readers. | ||
| output_path = self._get_output_for_dataset(dataset, split_dims) | ||
| if self.should_skip_file(output_path): | ||
| return False |
Collaborator
There was a problem hiding this comment.
Same here, let's log these skipped files :)
Alternatively, we can also add a log in the should_skip_file method.
Collaborator
|
Thank you for implementing these changes @mmarusiak! Could you please pull the latest from main and bump the version numbers in both |
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.
Fixes #538
Previously, all three splitters used an all-or-nothing approach: if any output file existed (via wildcard match), the entire input file was skipped. If even one output file was missing, the splitter re-split the whole input and overwrote all previously created children.
Now each splitter checks existence per output file and only generates the missing ones:
Added test_splits_only_missing_files for both GribSplitter/GribSplitterV2 (parametrized) and NetCdfSplitter: full split, delete one output file, re-split, assert only the deleted file was recreated and all others have unchanged modification times.