fix(reingest): rewrite embedded absolute paths when copying execution outputs#736
Merged
Merged
Conversation
… outputs
ESMValTool records absolute output paths in its diagnostic_provenance.yml
files. Reingest copies an execution's scratch tree to a new fragment with
shutil.copytree, which duplicates those paths verbatim, so
build_execution_result tried to relativise them against the new output
directory and raised ValueError ("not in the subpath of"), silently rolling
back every ESMValTool reingest.
Re-point the embedded paths from the original scratch directory to the new
one after copying so the result can be rebuilt.
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:
|
Replace the bespoke _rewrite_copied_paths helper with the existing climate_ref_core.output_files.rewrite_tree, which does the same content rewrite with longest-match-first ordering and the shared SANITISED_FILE_GLOBS set. Drops the now-redundant unit tests (rewrite_tree is covered in test_output_files.py); the end-to-end reingest regression test is retained.
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.
Description
ref executions reingestfailed for every ESMValTool diagnostic.Reingest creates a new execution and copies the original execution's scratch tree to the new fragment with
shutil.copytree, then re-runsbuild_execution_resultagainst it. ESMValTool records absolute output paths in itsdiagnostic_provenance.ymlfiles, andcopytreeduplicates those contents verbatim — so the copied provenance still pointed at the original execution's directory (.../<old_id>/executions/...).build_execution_resultthen tried to express those paths relative to the new output directory (.../<new_id>) and raised:The exception propagated to reingest's catch-all, which logged "Ingestion failed … Rolling back changes" and discarded the copy — so ESMValTool executions silently never reingested.
PMP/ILAMB were unaffected because they build their output lists by globbing the live output directory (always in-tree), whereas ESMValTool is the only provider that reads paths from a recorded artifact.
Fix
After
copytree, rewrite the copied text artifacts to use the new scratch dir. Binary artefacts are never touched and unchanged files are left alone.Checklist
Please confirm that this pull request has done the following:
changelog/