Skip to content

Issue 538: Skip individual split files that already exist#548

Open
mmarusiak wants to merge 1 commit into
google:mainfrom
mmarusiak:issue538-skip-creating-split-files-that-already-exist
Open

Issue 538: Skip individual split files that already exist#548
mmarusiak wants to merge 1 commit into
google:mainfrom
mmarusiak:issue538-skip-creating-split-files-that-already-exist

Conversation

@mmarusiak

Copy link
Copy Markdown
Contributor

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:

  • 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.

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.
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.

[weather-sp]: Skip creating split files that already exist

1 participant