fix(ingest): keep files absent from current ingest, warn instead of abort#677
Merged
Conversation
lewisjared
added a commit
that referenced
this pull request
May 15, 2026
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…bort
`ref datasets ingest` aborted with
`NotImplementedError("Removing files is not yet supported")` whenever
the same `instance_id` was registered twice in one run with a different
set of file paths each time. The streaming `--chunk-size` path makes
this dramatically more reachable, but it is a property of any catalog
where two distinct paths produce the same `instance_id` -- which
happens routinely with the content-based CMIP6 `complete` parser when
a mirror stores the same netCDF file under two different parent
activity directories (e.g. `/CMIP6/CMIP/IPSL/...` and
`/CMIP6/DAMIP/IPSL/...` for the same DAMIP-published file).
Treat files absent from the current ingest slice as kept-in-place with
a warning instead of raising. This matches the long-standing `TODO`
about preserving datasets that diagnostics may have already used, and
handles the cross-chunk-distance case uniformly -- the failing chunks
can be arbitrarily far apart in `os.walk()` order.
Closes #676
668c898 to
82fbd00
Compare
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.
Summary
ref datasets ingestaborts withNotImplementedError("Removing files is not yet supported")whenever the sameinstance_idis registered twice in one run with a different set of file paths each time.Honestly this should never happen under the DRS... but it does...
The
completeparser reads attributes from file content, not from the path. The following instance_ids have identical files (which conflict with their metadata on ESGF).This PR makes
register_datasettreat files absent from the current ingest slice as kept-in-place with a warning, instead of raising. This will likely break an execution which will now see both datasets, but I'd rather that than work around this because its just wrong.Test plan
test_register_dataset_raises_on_removalwithtest_register_dataset_keeps_absent_files_with_warningasserting the new union-then-warn behaviourpytest packages/climate-ref/tests/unit/datasets/(203 passed, 1 xfailed)ruff check,ruff format,mypy(pre-commit)Closes #676